• 欢迎访问开心洋葱网站,在线教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入开心洋葱 QQ群
  • 为方便开心洋葱网用户,开心洋葱官网已经开启复制功能!
  • 欢迎访问开心洋葱网站,手机也能访问哦~欢迎加入开心洋葱多维思维学习平台 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏开心洋葱吧~~~~~~~~~~~~~!
  • 由于近期流量激增,小站的ECS没能经的起亲们的访问,本站依然没有盈利,如果各位看如果觉着文字不错,还请看官给小站打个赏~~~~~~~~~~~~~!

一个不使用表格的三栏式布局模板

C# 水墨上仙 2103次浏览

URL: div+css” target=”_blank”>http://www.positioniseverything.net/piefecta-rigid.html
div+css的三栏式布局模板

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<!-- The above DOCTYPE and html lines and the meta http-equiv line below the head are critical. DO NOT DELETE them -->
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Your Page Title Here</title>
<style type="text/css" media="screen">@import url("css/noodle_real.css");</style>
<!-- import with quotes and brackets hides css from:
Netscape 4.x
Win IE 3
Win IE 4
Mac IE 4.01
Mac IE 4.5
Konqueror 2.1.2
Win Amaya 5.1
isn't that nice to know? -->
<style type="text/css">
/******************************************
Copyright Notice: Parts of these notes are
(c) Owen Briggs @ www.thenoodleincident.com
(for the font css file) (c) Big John @
www.positioniseverything.net and (c) Paul
O'Brien @ www.pmob.co.uk, all of whom
contributed significantly to the design of
the css and html code.
All other content is (c) ClevaTreva Designs
******************************************/
/***XXXXXXXXXXXXXXX Primary layout rules XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
 
To change many of the widths/heights requires that other certain values must
also be changed at the same time. For this reason, beside these critical
attributes (or nearby if comment hacks do not allow) are comments with the
calculations as to how to adjust them.
 
These guidance comments start with /*** and end with ***/
 
/***
You can delete these if you want, but do not delete MAC Hack comments (see
below).
 
To change the width of the entire layout, adjust the columns that make up the
total, remembering the borders. Remember, even one small mistake will degrade
or even break the layout, so be very careful!
 
For spacing within the cols, it's best to apply margins on content elements
inserted into the cols, because padding directly on those col elements will
change their widths, breaking the layout.
 
Certain hiding hacks have been used extensively in this layout, so here is a
quick explanation of them.
 
The Safari escape tab hack:
***************************
 
 (used on wrapper, and the 3 backgrounds for Moz
and Opera).
 
Puts an escape in front of a valid number in the style name to replace a
letter in that name, e.g. \65 is an e. A tab is then inserted (not a space).
The purpose of this hack is to hide some code from Safari. Unfortunately,
some other browsers (like IE) see it for what it should be (but NOT Safari),
and so we must undo the code for those browsers by other hacks.
 
The Tan hack:
*************
 
* html .anyelement {rules read only by IE/Win and IE/Mac}
 
The MAC hack:
*************
 
(first the active comment you are reading now must be
closed...) ***/
 
/* \*/
 
/* */
 
/***...Back in comment mode now. Anything between those two comment lines
will be hidden from IE/Mac. Don't use any comments within this hack or it will
close prematurely and IE/Mac will begin reading before it should.
 
The above two hacks are combined so as to feed rules only to IE/Win.
 
The Holly Hack:
***************
 
Proper use of backslash escape characters inside property names used in the
Holly hack can further segregate rules to be read by only IE6 from rules for
IE5.x/Win.
 
These hiding hacks, along with several other fixes, make possible this formerly
impossible layout. It is highly unlikely that new browsers will have any
problem with these valid hiding hacks, and we will have to wait for Microsoft
to release IE7.
 
If enabled in the PageMaker, the 100% height in the html and body styles makes
the design full height. It also breaks Moz because you should use min-height,
but that doesn't work! Note
how these 100% heights are hidden from IE Mac with
the MAC Hack, otherwise they break it.
 
XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX ***/
html,body{
  margin:0; /*** Do NOT set anything other than a left margin for the page
as this will break the design ***/
  padding:0;
  border:0;
/* \*/
  height:100%;
/* Last height declaration hidden from Mac IE 5.x */
}
body{
  background:#EEEEEE;
  min-width:782px; /*** This is needed for moz. Otherwise, the header and footer will
slide off the left side of the page if the screen width is narrower than the design.
Not seen by IE. Left Col + Right Col + Center Col + Both Inner Borders + Both Outer Borders ***/
  text-align:center; /*** IE/Win (not IE/MAC) alignment of page ***/
}
.clear{
  clear:both;
/*** these next attributes are designed to keep the div
height to 0 pixels high, critical for Safari and Netscape 7 ***/
  height:1px;
  overflow:hidden;
  line-height:1%;
  font-size:0px;
  margin-bottom:-1px;
}
* html .clear{height:auto;margin-bottom:0} /*** stops IE browsers from displaying
the clear div/br in the page, as these are for Moz/Opera and
Safari only. If IE 5.x Win DID display these, the page is too high ***/
#fullheightcontainer{
  margin-left:auto; /*** Mozilla/Opera/Mac IE 5.x alignment of page ***/
  margin-right:auto; /*** Mozilla/Opera/Mac IE 5.x alignment of page ***/
  text-align:left; /*** IE Win re-alignment of page if page is centered ***/
  position:relative; /*** Needed for IE, othewise header and footer aren't contained
directly above and below the body ***/
  width:782px; /*** Needed for Moz/Opera to keep page from sliding to left side of
page when it calculates auto margins above. Can't use min-width. Note that putting
width in #fullheightcontainer shows it to IE and causes problems, so IE needs a hack
to remove this width. Left Col + Right Col + Center Col + Both Inner Border + Both Outer Borders ***/
/* \*/
  height:100%;
/* Last height declaration hidden from Mac IE 5.x */
/*** Needed for Moz to give full height design if page content is
too small to fill the page ***/
}
#wrapper{
  min-height:100%; /*** moz uses this to make full height design. As this #wrapper
is inside the #fullheightcontainer which is 100% height, moz will not inherit heights
further into the design inside this container, which you should be able to do with
use of the min-height style. Instead, Mozilla ignores the height:100% or
min-height:100% from this point inwards to the center of the design - a nasty bug.
If you change this to height:100% moz won't expand the design if content grows.
Aaaghhh. I pulled my hair out over this for days. ***/
/* \*/
  height:100%;
/* Last height declaration hidden from Mac IE 5.x */
/*** Fixes height for non moz browsers, to full height ***/
  border-right:1px solid #000000; /*** Sets the external right side border. ***/
  border-left:1px solid #000000; /*** Sets the external left side border. ***/
  background:#FFCCCC; /*** Set background color for side columns for Safari & IE ***/
}
#wrapp\65	r{ /*** for Opera and Moz (and some others will see it, but NOT Safari) ***/
  height:auto; /*** For moz to stop it fixing height to 100% ***/
}
/* \*/
* html #wrapper{
  height:100%;
}
/* Last style with height declaration hidden from Mac IE 5.x */
/*** Fixes height for IE, back to full height,
from esc tab hack moz min-height solution ***/
#outer{
  z-index:1; /*** Critical value for Moz/Opera Background Column colors fudge to work ***/
  position:relative; /*** IE needs this or the contents won't show outside the parent container. ***/
  margin-left:150px; /*** Critical left col dimension value = left col width ***/
  width:478px; /*** Critical left and right col/divider dimension value (moves inversly) = center col width ***/
  border-right:1px solid #000000; /*** Sets the internal right side border. ***/
  border-left:1px solid #000000; /*** Sets the internal left side border. ***/
  background:#ADD8E6; /*** Sets background of center col***/
/* \*/
  height:100%;
/* Last height declaration hidden from Mac IE 5.x */
/*** Needed for full height inner borders in Win IE ***/
}
/*** The next style hack for widths are NOT needed if no internal side borders are needed ***/
* html #outer{ /*** IE5.x/win box model fix ***/
  width:480px; /*** Critical left and right col/divider dimension value
(moves inversly) = Center Col Width + Both Inner Borders ***/
  w\idth:478px; /*** Critical left and right col/divider dimension value (moves inversly) = Center Col Width ***/
}
#float-wrap{
  width:478px; /*** Critical left and right col/divider dimension value (moves inversly) = Center Col Width ***/
  margin-right:-1px; /*** Static fix, doesn't change ***/
  float:left;
  display:inline;
}
#left{
  width:152px; /*** Critical left col/divider dimension value = Left Col Width + 1px + One Internal Border Width ***/
  float:left;
  display:inline;
  position:relative; /*** IE needs this or the contents won't show
outside the parent container. ***/
  margin-left:-151px; /*** Critical left col/divider dimension value = left col width + one internal border width ***/
}
*>html #left{width:151px;} /*** Fix only for IE/Mac = left col width + one internal border width ***/
#container-left{
  width:150px; /*** Critical left col dimension value = left col width - 1px ***/
}
#right{
  float:left;
  display:inline;
  width:152px; /*** Critical right col/divider dimension value = right col width + 2px ***/
  margin-right:-150px; /*** Critical right col/divider dimension value = negative right col width ***/
  margin-left:-1px; /*** Static fix ***/
  position:relative; /*** IE needs this or the contents won't show
outside the parent container. ****/
}
/* \*/
* html #right{
  width:152px;
  margin-left:0px;
  margin-right:-500px;
  mar\gin-right:-152px;
}
/* Above style hidden from Mac IE */
/*** These commented-out rules below are there to explain the "Critical" info
     for the rules above, because comments must not appear within the Mac-hack.
     The "rules" below are not active, they are just for teaching purposes.
 
* html #right{
  width:152px; Critical right col/divider dimension value = right col width + one internal border width + 1px ***
  margin-left:0px; *** Critical right divider dimension value = a static 0px ***
  margin-right:-500px; *** IE5.x/win fix, must be above a critical number, but very high values appear okay ***
  mar\gin-right:-152px; *** Critical right col/divider dimension value  = negative (right col width + one internal border width + 1px) ***
}
***/
#container-right{
/* \*/
  width:150px;
/* Above hidden from IE-Mac */
/*** Critical right col dimension value = right col width ***/
  margin-left:3px; /*** Critical right divider dimension value = one internal border width + 2px ***/
}
/* \*/
* html #container-right{
  fl\oat:right;
  di\splay:inline;
  margin-left:2px;
  mar\gin-left:0px;
}
/* Above style hidden from Mac IE */
/*** Above margin left set to = one internal border width + 1px ***/
/*** Static fixes ***/
 
/*** a Note on the Holly hack: if IE/Win shows bugs it's a good idea to apply the height:1%
     hack to different elements and see if that fixes the problem. Sometimes it may be
     necessary to use "position: relative;" on certain elements, but it's hard to tell in
     advance which elements will need such fixes. ***/
/*** This is a STATIC fix for IE5/Win at the largest text size setting. ***/
/* \*/
* html #left{margin-right:-3px;}
/* Above style hidden from Mac IE */
/*** All the IE fixes that are inside seperate "Mac-hacks" may be grouped within
     just one Mac-hack for convenience if desired. However, each fix must come
     later than the rule it is fixing or the fix itself will be overridden. ***/
#center{
  width:478px; /*** Set to = center col width ***/
  float:right;
  display:inline;
/* \*/
  margin-left:-1px;
/* Hidden from IE-mac */
}
/*** clearheader heights are made from header height + borders +
any sidebar box height, less any sidebar intrusion.
Similar calcs for footers. ***/
#clearheadercenter{
  height:72px; /*** needed to make room for header in center column ***/
  overflow:hidden;
}
#clearheaderleft{
  height:72px; /*** needed to make room for header in left column ***/
  overflow:hidden;
}
#clearheaderright{
  height:72px; /*** needed to make room for header in right column ***/
  overflow:hidden;
}
#clearfootercenter{
  height:52px; /*** needed to make room for footer in center column ***/
  overflow:hidden;
}
#clearfooterleft{
  height:52px; /*** needed to make room for footer in left column ***/
  overflow:hidden;
}
#clearfooterright{
  height:52px; /*** needed to make room for footer in right column ***/
  overflow:hidden;
}
#footer{
  z-index:1; /*** Critical value for Moz/Opera Background Column colors fudge to work ***/
  position:absolute;
  clear: both;
  width:782px; /*** Set to Left Col + Right Col + Center Col + Both Inner Borders +
Both External Borders ***/
  height:52px; /*** = Bottom Margin + One Outer Border + body to footer divider depth +
subfooter1 height + any other subfooter heights ***/
  overflow:hidden;
  margin-top:-52px; /*** negative height ***/
}
#subfooter1{
  background:#FFFFCC; /*** Background Color of Sub-footer #1 ***/
  text-align:center;
  margin:0 1px; /*** Margin to show left and right External Borders - all sub-headers and sub-footers ***/
  height:50px; /*** sub-footer row height ***/
}
#header{
  z-index:1; /*** Critical value for Moz/Opera Background Column colors fudge to work ***/
  position:absolute;
  top:0px;
  width:782px; /*** Set to Left Col (not if left sidebar fully intrudes into header or left sidebar is off)
+ Right Col (not if right sidebar fully intrudes into header or right sidebar is off) + Center Col + Both Inner
Borders (not if any sidebar intrudes into header or footer, or Inner Borders are off) + Both External Borders
(not if external borders are off) ***/
  height:72px; /*** = Top Margin + One Outer Border + header to body divider depth +
subheader1 height + any other subheader heights ***/
  overflow:hidden;
}
.outer_horiz_border, .sb_outer_horiz_border{
  background:#000000;
  height:1px;
  overflow:hidden;
  font-size:0px
}
#subheader1{
  background:#FFFFCC; /*** Background Color of Sub-header #1 ***/
  text-align:center;
  margin:0 1px; /*** Margin to show left and right External Borders - all sub-headers and sub-footers ***/
  height:70px; /*** sub-header row height ***/
}
#gfx_bg_middle{
  top:0px;
  position:absolute;
  height:100%;
  overflow:hidden;
  width:478px; /*** = Center Col Width ***/
  margin-left:150px; /*** = Left Col Width ***/
  background:#ADD8E6; /*** Set background color for center column for Mozilla & Opera ***/
  border-right:1px solid #000000; /*** Sets the internal left side border.
Remove border styles if no Internal Borders. ***/
  border-left:1px solid #000000;
  border-left:1px solid #000000;
}
* html #gfx_bg_middle{
  display:none; /*** Hides the moz fix from IE ***/
}
</style>
<!--[if IE]>
<style type="text/css">
/*** The rule below prevents long urls from widening floated cols and breaking the layout
     in IE. It is not W3C valid, but if placed within a "Conditional comment" it will be hidden
     from all user agents other than IE/Win, and thus validate. This fix fails in IE5/Win.
     http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp ***/
#outer{word-wrap:break-word;}
</style>
<![endif]-->
</head>
<body>
<div id="fullheightcontainer">
  <div id="wrapper">
    <div id="outer">
      <div id="float-wrap">
        <div id="center">
          <div id="clearheadercenter"></div>
          <div id="container-center">
            <p>
              This is the<br />Main Content<br />
            </p>
          </div>
          <div id="clearfootercenter"></div>
        </div>
        <div id="left">
          <div id="clearheaderleft"></div>
          <div id="container-left">
            <p>
              This is the Left Sidebar<br />
            </p>
          </div>
          <div id="clearfooterleft"></div>
        </div>
      </div>
      <div id="right">
        <div id="clearheaderright"></div>
        <div id="container-right">
          <p>
            This is the Right Sidebar<br />
          </p>
        </div>
        <div id="clearfooterright"></div>
      </div>
      <div class="clear"> </div>
    </div>
    <div id="gfx_bg_middle"> </div>
  </div>
  <div id="header">
    <div class="outer_horiz_border"> </div>
    <div id="subheader1">
      <p>
        This is Sub-Header #1 (with Fixed Height)
      </p>
    </div>
    <div class="outer_horiz_border"> </div>
  </div>
  <div class="clear"> </div>
  <div id="footer">
    <div class="outer_horiz_border"> </div>
    <div id="subfooter1">
      <p>
        This is Sub-Footer #1 (with Fixed Height)
      </p>
    </div>
    <div class="outer_horiz_border"> </div>
  </div>
</div>
</body>
</html>


喜欢 (0)
加载中……