Here is an example of HTML code I am working with:
<div class="container clearfix">
<div class="grid_8 omega">
<ul class="nav">
<li><a href="#">About</a></li>
<li><a href="#">Cupcakes & Prices</a></li>
<li><a href="#">Locations</a></li>
<li class="last"><a href="#">Contact Us</a></li>
</ul>
</div>
This code is styled as follows:
ul.nav {
margin-top: 18.18%;
list-style: none;
float: right;
}
ul.nav li {
float: left;
margin-right: 40px;
}
When I attempted to convert the fixed pixel value to a percentage for a more fluid design, I followed the formula target / context = result. In this case, it was calculated as 40px / 660px = 0.06 or roughly 6%. After making this adjustment, my layout changed and did not respond as expected when resizing the browser window.
I am struggling to understand why using percentages for margin-right is not giving me the desired outcome. It seems that no matter what percentage value I input, the styling does not behave correctly. Could it be that I am misunderstanding how to use percentages in this context? Why isn't my approach yielding the intended results?