Superb 3-column tableless layout


/ Published in: CSS
Save to your folder(s)

Also see the automagic column builder on this page.

YOU NEED THIS FILE TOO! Place it in the subfolder, "css/".

http://snipurl.com/3col_support_css


Copy this code and paste it in your HTML
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
  4. <!-- The above DOCTYPE and html lines and the meta http-equiv line below the head are critical. DO NOT DELETE them -->
  5. <head>
  6. <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  7. <title>Your Page Title Here</title>
  8. <style type="text/css" media="screen">@import url("css/noodle_real.css");</style>
  9. <!-- import with quotes and brackets hides css from:
  10. Netscape 4.x
  11. Win IE 3
  12. Win IE 4
  13. Mac IE 4.01
  14. Mac IE 4.5
  15. Konqueror 2.1.2
  16. Win Amaya 5.1
  17. isn't that nice to know? -->
  18. <style type="text/css">
  19. /******************************************
  20. Copyright Notice: Parts of these notes are
  21. (c) Owen Briggs @ www.thenoodleincident.com
  22. (for the font css file) (c) Big John @
  23. www.positioniseverything.net and (c) Paul
  24. O'Brien @ www.pmob.co.uk, all of whom
  25. contributed significantly to the design of
  26. the css and html code.
  27. All other content is (c) ClevaTreva Designs
  28. ******************************************/
  29. /***XXXXXXXXXXXXXXX Primary layout rules XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
  30.  
  31. To change many of the widths/heights requires that other certain values must
  32. also be changed at the same time. For this reason, beside these critical
  33. attributes (or nearby if comment hacks do not allow) are comments with the
  34. calculations as to how to adjust them.
  35.  
  36. These guidance comments start with /*** and end with ***/
  37.  
  38. /***
  39. You can delete these if you want, but do not delete MAC Hack comments (see
  40. below).
  41.  
  42. To change the width of the entire layout, adjust the columns that make up the
  43. total, remembering the borders. Remember, even one small mistake will degrade
  44. or even break the layout, so be very careful!
  45.  
  46. For spacing within the cols, it's best to apply margins on content elements
  47. inserted into the cols, because padding directly on those col elements will
  48. change their widths, breaking the layout.
  49.  
  50. Certain hiding hacks have been used extensively in this layout, so here is a
  51. quick explanation of them.
  52.  
  53. The Safari escape tab hack:
  54. ***************************
  55.  
  56.  (used on wrapper, and the 3 backgrounds for Moz
  57. and Opera).
  58.  
  59. Puts an escape in front of a valid number in the style name to replace a
  60. letter in that name, e.g. \65 is an e. A tab is then inserted (not a space).
  61. The purpose of this hack is to hide some code from Safari. Unfortunately,
  62. some other browsers (like IE) see it for what it should be (but NOT Safari),
  63. and so we must undo the code for those browsers by other hacks.
  64.  
  65. The Tan hack:
  66. *************
  67.  
  68. * html .anyelement {rules read only by IE/Win and IE/Mac}
  69.  
  70. The MAC hack:
  71. *************
  72.  
  73. (first the active comment you are reading now must be
  74. closed...) ***/
  75.  
  76. /* \*/
  77.  
  78. /* */
  79.  
  80. /***...Back in comment mode now. Anything between those two comment lines
  81. will be hidden from IE/Mac. Don't use any comments within this hack or it will
  82. close prematurely and IE/Mac will begin reading before it should.
  83.  
  84. The above two hacks are combined so as to feed rules only to IE/Win.
  85.  
  86. The Holly Hack:
  87. ***************
  88.  
  89. Proper use of backslash escape characters inside property names used in the
  90. Holly hack can further segregate rules to be read by only IE6 from rules for
  91. IE5.x/Win.
  92.  
  93. These hiding hacks, along with several other fixes, make possible this formerly
  94. impossible layout. It is highly unlikely that new browsers will have any
  95. problem with these valid hiding hacks, and we will have to wait for Microsoft
  96. to release IE7.
  97.  
  98. If enabled in the PageMaker, the 100% height in the html and body styles makes
  99. the design full height. It also breaks Moz because you should use min-height,
  100. but that doesn't work! Note
  101. how these 100% heights are hidden from IE Mac with
  102. the MAC Hack, otherwise they break it.
  103.  
  104. XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX ***/
  105. html,body{
  106. margin:0; /*** Do NOT set anything other than a left margin for the page
  107. as this will break the design ***/
  108. padding:0;
  109. border:0;
  110. /* \*/
  111. height:100%;
  112. /* Last height declaration hidden from Mac IE 5.x */
  113. }
  114. body{
  115. background:#EEEEEE;
  116. min-width:782px; /*** This is needed for moz. Otherwise, the header and footer will
  117. slide off the left side of the page if the screen width is narrower than the design.
  118. Not seen by IE. Left Col + Right Col + Center Col + Both Inner Borders + Both Outer Borders ***/
  119. text-align:center; /*** IE/Win (not IE/MAC) alignment of page ***/
  120. }
  121. .clear{
  122. clear:both;
  123. /*** these next attributes are designed to keep the div
  124. height to 0 pixels high, critical for Safari and Netscape 7 ***/
  125. height:1px;
  126. overflow:hidden;
  127. line-height:1%;
  128. font-size:0px;
  129. margin-bottom:-1px;
  130. }
  131. * html .clear{height:auto;margin-bottom:0} /*** stops IE browsers from displaying
  132. the clear div/br in the page, as these are for Moz/Opera and
  133. Safari only. If IE 5.x Win DID display these, the page is too high ***/
  134. #fullheightcontainer{
  135. margin-left:auto; /*** Mozilla/Opera/Mac IE 5.x alignment of page ***/
  136. margin-right:auto; /*** Mozilla/Opera/Mac IE 5.x alignment of page ***/
  137. text-align:left; /*** IE Win re-alignment of page if page is centered ***/
  138. position:relative; /*** Needed for IE, othewise header and footer aren't contained
  139. directly above and below the body ***/
  140. width:782px; /*** Needed for Moz/Opera to keep page from sliding to left side of
  141. page when it calculates auto margins above. Can't use min-width. Note that putting
  142. width in #fullheightcontainer shows it to IE and causes problems, so IE needs a hack
  143. to remove this width. Left Col + Right Col + Center Col + Both Inner Border + Both Outer Borders ***/
  144. /* \*/
  145. height:100%;
  146. /* Last height declaration hidden from Mac IE 5.x */
  147. /*** Needed for Moz to give full height design if page content is
  148. too small to fill the page ***/
  149. }
  150. #wrapper{
  151. min-height:100%; /*** moz uses this to make full height design. As this #wrapper
  152. is inside the #fullheightcontainer which is 100% height, moz will not inherit heights
  153. further into the design inside this container, which you should be able to do with
  154. use of the min-height style. Instead, Mozilla ignores the height:100% or
  155. min-height:100% from this point inwards to the center of the design - a nasty bug.
  156. If you change this to height:100% moz won't expand the design if content grows.
  157. Aaaghhh. I pulled my hair out over this for days. ***/
  158. /* \*/
  159. height:100%;
  160. /* Last height declaration hidden from Mac IE 5.x */
  161. /*** Fixes height for non moz browsers, to full height ***/
  162. border-right:1px solid #000000; /*** Sets the external right side border. ***/
  163. border-left:1px solid #000000; /*** Sets the external left side border. ***/
  164. background:#FFCCCC; /*** Set background color for side columns for Safari & IE ***/
  165. }
  166. #wrapp\65 r{ /*** for Opera and Moz (and some others will see it, but NOT Safari) ***/
  167. height:auto; /*** For moz to stop it fixing height to 100% ***/
  168. }
  169. /* \*/
  170. * html #wrapper{
  171. height:100%;
  172. }
  173. /* Last style with height declaration hidden from Mac IE 5.x */
  174. /*** Fixes height for IE, back to full height,
  175. from esc tab hack moz min-height solution ***/
  176. #outer{
  177. z-index:1; /*** Critical value for Moz/Opera Background Column colors fudge to work ***/
  178. position:relative; /*** IE needs this or the contents won't show outside the parent container. ***/
  179. margin-left:150px; /*** Critical left col dimension value = left col width ***/
  180. width:478px; /*** Critical left and right col/divider dimension value (moves inversly) = center col width ***/
  181. border-right:1px solid #000000; /*** Sets the internal right side border. ***/
  182. border-left:1px solid #000000; /*** Sets the internal left side border. ***/
  183. background:#ADD8E6; /*** Sets background of center col***/
  184. /* \*/
  185. height:100%;
  186. /* Last height declaration hidden from Mac IE 5.x */
  187. /*** Needed for full height inner borders in Win IE ***/
  188. }
  189. /*** The next style hack for widths are NOT needed if no internal side borders are needed ***/
  190. * html #outer{ /*** IE5.x/win box model fix ***/
  191. width:480px; /*** Critical left and right col/divider dimension value
  192. (moves inversly) = Center Col Width + Both Inner Borders ***/
  193. w\idth:478px; /*** Critical left and right col/divider dimension value (moves inversly) = Center Col Width ***/
  194. }
  195. #float-wrap{
  196. width:478px; /*** Critical left and right col/divider dimension value (moves inversly) = Center Col Width ***/
  197. margin-right:-1px; /*** Static fix, doesn't change ***/
  198. float:left;
  199. display:inline;
  200. }
  201. #left{
  202. width:152px; /*** Critical left col/divider dimension value = Left Col Width + 1px + One Internal Border Width ***/
  203. float:left;
  204. display:inline;
  205. position:relative; /*** IE needs this or the contents won't show
  206. outside the parent container. ***/
  207. margin-left:-151px; /*** Critical left col/divider dimension value = left col width + one internal border width ***/
  208. }
  209. *>html #left{width:151px;} /*** Fix only for IE/Mac = left col width + one internal border width ***/
  210. #container-left{
  211. width:150px; /*** Critical left col dimension value = left col width - 1px ***/
  212. }
  213. #right{
  214. float:left;
  215. display:inline;
  216. width:152px; /*** Critical right col/divider dimension value = right col width + 2px ***/
  217. margin-right:-150px; /*** Critical right col/divider dimension value = negative right col width ***/
  218. margin-left:-1px; /*** Static fix ***/
  219. position:relative; /*** IE needs this or the contents won't show
  220. outside the parent container. ****/
  221. }
  222. /* \*/
  223. * html #right{
  224. width:152px;
  225. margin-left:0px;
  226. margin-right:-500px;
  227. mar\gin-right:-152px;
  228. }
  229. /* Above style hidden from Mac IE */
  230. /*** These commented-out rules below are there to explain the "Critical" info
  231.   for the rules above, because comments must not appear within the Mac-hack.
  232.   The "rules" below are not active, they are just for teaching purposes.
  233.  
  234. * html #right{
  235.   width:152px; Critical right col/divider dimension value = right col width + one internal border width + 1px ***
  236.   margin-left:0px; *** Critical right divider dimension value = a static 0px ***
  237.   margin-right:-500px; *** IE5.x/win fix, must be above a critical number, but very high values appear okay ***
  238.   mar\gin-right:-152px; *** Critical right col/divider dimension value = negative (right col width + one internal border width + 1px) ***
  239. }
  240. ***/
  241. #container-right{
  242. /* \*/
  243. width:150px;
  244. /* Above hidden from IE-Mac */
  245. /*** Critical right col dimension value = right col width ***/
  246. margin-left:3px; /*** Critical right divider dimension value = one internal border width + 2px ***/
  247. }
  248. /* \*/
  249. * html #container-right{
  250. fl\oat:right;
  251. di\splay:inline;
  252. margin-left:2px;
  253. mar\gin-left:0px;
  254. }
  255. /* Above style hidden from Mac IE */
  256. /*** Above margin left set to = one internal border width + 1px ***/
  257. /*** Static fixes ***/
  258.  
  259. /*** a Note on the Holly hack: if IE/Win shows bugs it's a good idea to apply the height:1%
  260.   hack to different elements and see if that fixes the problem. Sometimes it may be
  261.   necessary to use "position: relative;" on certain elements, but it's hard to tell in
  262.   advance which elements will need such fixes. ***/
  263. /*** This is a STATIC fix for IE5/Win at the largest text size setting. ***/
  264. /* \*/
  265. * html #left{margin-right:-3px;}
  266. /* Above style hidden from Mac IE */
  267. /*** All the IE fixes that are inside seperate "Mac-hacks" may be grouped within
  268.   just one Mac-hack for convenience if desired. However, each fix must come
  269.   later than the rule it is fixing or the fix itself will be overridden. ***/
  270. #center{
  271. width:478px; /*** Set to = center col width ***/
  272. float:right;
  273. display:inline;
  274. /* \*/
  275. margin-left:-1px;
  276. /* Hidden from IE-mac */
  277. }
  278. /*** clearheader heights are made from header height + borders +
  279. any sidebar box height, less any sidebar intrusion.
  280. Similar calcs for footers. ***/
  281. #clearheadercenter{
  282. height:72px; /*** needed to make room for header in center column ***/
  283. overflow:hidden;
  284. }
  285. #clearheaderleft{
  286. height:72px; /*** needed to make room for header in left column ***/
  287. overflow:hidden;
  288. }
  289. #clearheaderright{
  290. height:72px; /*** needed to make room for header in right column ***/
  291. overflow:hidden;
  292. }
  293. #clearfootercenter{
  294. height:52px; /*** needed to make room for footer in center column ***/
  295. overflow:hidden;
  296. }
  297. #clearfooterleft{
  298. height:52px; /*** needed to make room for footer in left column ***/
  299. overflow:hidden;
  300. }
  301. #clearfooterright{
  302. height:52px; /*** needed to make room for footer in right column ***/
  303. overflow:hidden;
  304. }
  305. #footer{
  306. z-index:1; /*** Critical value for Moz/Opera Background Column colors fudge to work ***/
  307. position:absolute;
  308. clear: both;
  309. width:782px; /*** Set to Left Col + Right Col + Center Col + Both Inner Borders +
  310. Both External Borders ***/
  311. height:52px; /*** = Bottom Margin + One Outer Border + body to footer divider depth +
  312. subfooter1 height + any other subfooter heights ***/
  313. overflow:hidden;
  314. margin-top:-52px; /*** negative height ***/
  315. }
  316. #subfooter1{
  317. background:#FFFFCC; /*** Background Color of Sub-footer #1 ***/
  318. text-align:center;
  319. margin:0 1px; /*** Margin to show left and right External Borders - all sub-headers and sub-footers ***/
  320. height:50px; /*** sub-footer row height ***/
  321. }
  322. #header{
  323. z-index:1; /*** Critical value for Moz/Opera Background Column colors fudge to work ***/
  324. position:absolute;
  325. top:0px;
  326. width:782px; /*** Set to Left Col (not if left sidebar fully intrudes into header or left sidebar is off)
  327. + Right Col (not if right sidebar fully intrudes into header or right sidebar is off) + Center Col + Both Inner
  328. Borders (not if any sidebar intrudes into header or footer, or Inner Borders are off) + Both External Borders
  329. (not if external borders are off) ***/
  330. height:72px; /*** = Top Margin + One Outer Border + header to body divider depth +
  331. subheader1 height + any other subheader heights ***/
  332. overflow:hidden;
  333. }
  334. .outer_horiz_border, .sb_outer_horiz_border{
  335. background:#000000;
  336. height:1px;
  337. overflow:hidden;
  338. font-size:0px
  339. }
  340. #subheader1{
  341. background:#FFFFCC; /*** Background Color of Sub-header #1 ***/
  342. text-align:center;
  343. margin:0 1px; /*** Margin to show left and right External Borders - all sub-headers and sub-footers ***/
  344. height:70px; /*** sub-header row height ***/
  345. }
  346. #gfx_bg_middle{
  347. top:0px;
  348. position:absolute;
  349. height:100%;
  350. overflow:hidden;
  351. width:478px; /*** = Center Col Width ***/
  352. margin-left:150px; /*** = Left Col Width ***/
  353. background:#ADD8E6; /*** Set background color for center column for Mozilla & Opera ***/
  354. border-right:1px solid #000000; /*** Sets the internal left side border.
  355. Remove border styles if no Internal Borders. ***/
  356. border-left:1px solid #000000;
  357. border-left:1px solid #000000;
  358. }
  359. * html #gfx_bg_middle{
  360. display:none; /*** Hides the moz fix from IE ***/
  361. }
  362. </style>
  363. <!--[if IE]>
  364. <style type="text/css">
  365. /*** The rule below prevents long urls from widening floated cols and breaking the layout
  366.   in IE. It is not W3C valid, but if placed within a "Conditional comment" it will be hidden
  367.   from all user agents other than IE/Win, and thus validate. This fix fails in IE5/Win.
  368.   http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp ***/
  369. #outer{word-wrap:break-word;}
  370. </style>
  371. <![endif]-->
  372. </head>
  373. <body>
  374. <div id="fullheightcontainer">
  375. <div id="wrapper">
  376. <div id="outer">
  377. <div id="float-wrap">
  378. <div id="center">
  379. <div id="clearheadercenter"></div>
  380. <div id="container-center">
  381. <p>
  382. This is the<br />Main Content<br />
  383. </p>
  384. </div>
  385. <div id="clearfootercenter"></div>
  386. </div>
  387. <div id="left">
  388. <div id="clearheaderleft"></div>
  389. <div id="container-left">
  390. <p>
  391. This is the Left Sidebar<br />
  392. </p>
  393. </div>
  394. <div id="clearfooterleft"></div>
  395. </div>
  396. </div>
  397. <div id="right">
  398. <div id="clearheaderright"></div>
  399. <div id="container-right">
  400. <p>
  401. This is the Right Sidebar<br />
  402. </p>
  403. </div>
  404. <div id="clearfooterright"></div>
  405. </div>
  406. <div class="clear">&nbsp;</div>
  407. </div>
  408. <div id="gfx_bg_middle">&nbsp;</div>
  409. </div>
  410. <div id="header">
  411. <div class="outer_horiz_border">&nbsp;</div>
  412. <div id="subheader1">
  413. <p>
  414. This is Sub-Header #1 (with Fixed Height)
  415. </p>
  416. </div>
  417. <div class="outer_horiz_border">&nbsp;</div>
  418. </div>
  419. <div class="clear">&nbsp;</div>
  420. <div id="footer">
  421. <div class="outer_horiz_border">&nbsp;</div>
  422. <div id="subfooter1">
  423. <p>
  424. This is Sub-Footer #1 (with Fixed Height)
  425. </p>
  426. </div>
  427. <div class="outer_horiz_border">&nbsp;</div>
  428. </div>
  429. </div>
  430. </body>
  431. </html>

URL: http://www.positioniseverything.net/piefecta-rigid.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.