Better alignment css div (3 columns, medium large)
I want the main html text (div.main) to be next to the standard paper size (8.5inch - 1in margin on both = 6.5)
I want my sidebar menu to be outside of this. So I figured out how to lock the page to 1024 res (I am using 996px so I have room for a vertical scrollbar)
It looks pretty good at 1024 and 1280 pixels, but I'm not sure which is higher. Also maybe you have a suggestion on how best to reconcile this (by keeping 6.5in in the center)
index.html
<div>
<div class="menu">
<ul>
<li><a href="">Home</a></li>
<li>Test</li>
<li>Test 2</li>
<li>Contact</li>
</ul>
</div>
</div>
<div class="row">
<div class="dummy"> </div>
<div class="main">
lots of textlots of textlots of textlots of textlots of textlots of textlots of textlots of text
...
lots of textlots of textlots of textlots of textlots of textlots of textlots of textlots of text
</div>
<div class="sidebar">
Some links here</br>
<br>Some links here</br>
<br>Some links here</br>
<br>Some links here</br>
<br>Some links here</br>
</div>
</div>
</body>
</html>
my.css:
div.row
{
width: 996px;
margin-left: auto;
margin-right: auto;
}
div.dummy {
float: left;
padding-right: 148px;
}
div.sidebar {
float: left;
padding-left: 32px;
}
div.main
{
width: 6.5in;
float: left;
}
.menu { padding-bottom: 60px; }
.menu ul { margin:0px auto; }
.menu li {
width: 22%;
text-align:center;
display:block;
float:left;
}
.menu a { display:block; }
Pixels are variable width, totally dependent on the viewer. For example, at the extremes, the iPhone is about 2 inches wide by 380 pixels wide. A typical 15 "monitor is about 8" wide and 800 pixels wide. Thus, the iPhone is about 4 times the resolution.
Also, if you change the resolution of the same monitor - from 800x600 to 1024x768 - you now have more pixels in the same physical space. This means that what was shown as 7 inches to now may appear to be approximately 5 inches.
The only way to get around this is to use s pt
instead px
. 72pts is approximately 1 inch. I personally never use pt
s, but have heard that browsers are very inconsistent in their handling of the CSS that uses them.
Therefore, to answer your specific question, you will need to use a fixed size overall on the page, just enough to accommodate your sidebar and your #main
div. Float one to the left and the other to the right.
a source to share