html - Full browser width list, but text has max-width -
i have full browser width list background color (which changes color on hover). want li
text text-align:left
, have max-width , left , right margins equal – background color still full browser width. how do this?
i have made jsfiddle here.
as put max-width on li
, background color shrink max-width. there way target text within list?
<div class="case_study_links"> <ul> <li><a href="google.html">abbey meadow flowers<br>helping grow sustainable florists</a></li> <li><a href="google.html">collins environmental<br>differentiating ecologists competitors</a></li> <li><a href="google.html">university of oxford<br>branding research project on young migrants</a></li> <li><a href="google.html">small woods<br>new brand brings credibility organisation</a></li> <li><a href="google.html">good energy<br>rebranding helps double customer numbers</a></li> </ul> </div> .case_study_links li { list-style: none; font-size:1.8rem; text-align:left; border-top:1px solid white; } .case_study_links a:link { color:white; display:block; padding:4.8rem 0; background-color:rgb(149,199,201);} .case_study_links a:visited { color:white; display:block; padding:4.8rem 0; background-color:rgb(149,199,201);} .case_study_links a:hover { color:white; display:block; padding:4.8rem 0; background-color:rgb(134,179,181);} .case_study_links a:active { color:white; display:block; padding:4.8rem 0; background-color:rgb(134,179,181);}
wrap text in <span class="mytexts">
, add css properties it:
.mytexts { max-width:100px; // or want margin:auto }
Comments
Post a Comment