HTML/CSS/Layout/One Column

Материал из Web эксперт
Версия от 08:16, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

1 column, header, content, footer

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
#outer {
  min-height: 100%;
  width: 612px;
  background: #eee;
  position: relative;
}
* html #outer {
  height: 100%
}
#header {
  border: 1px solid #000;
  background: #ccc;
  height: 40px;
}
#footer {
  position: absolute;
  bottom: 0;
  left: 0;
  background: #bbb;
  height: 40px;
  border-top: 1px solid #000;
  width: 98%;
}
#clearfooter {
  clear: both;
  height: 40px;
}
</style>
</head>
<body>
<div id="outer">
  <div id="header">Header</div>
  <p>Content</p>
  <p>Content</p>
  <div id="clearfooter"></div>
  <div id="footer">Footer</div>
</div>
</body>
</html>



Article layout

 

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>The Effect of the Internet on Psychological Theories of Self</title>
    <style rel="stylesheet" type="text/css">
body {
  background-color: #000000;
}
div.page {
  width: 650px;
  border-style: solid;
  border-width: 1px;
  border-color: #666;
}
div.heading {
  background-color: #999;
  padding: 10px;
}
div.body {
  background-color: #EFEFEF;
  padding: 10px;
}
h1 {
  font-size: 22pt;
  color: #000066;
}
h2 {
  font-size: 18pt;
  color: #000066;
}
p {
  font-size: 14pt;
  color: #000000;
}
</style>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  </head>
  </head>
  <body>
    <div class="page">
      <div class="heading">
            <h1>Header</h1>
      </div>
      <div class="body">
            <h2>Abstract</h2>
            <p>identity.</p>
            <p>This is a test. This is a test. .</p>
          ...
      </div>
    </div>
  </body>
</html>



Header, sub header, footer with one column

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Splash page layout</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style rel="stylesheet" type="text/css">
#wrapper {
  border: 1px solid #033;
  position: relative;
}

body#cols3 #navigation {
  position: absolute;
  top: 6.8em;
  left: 0;
}
body#cols3 #related {
  position: absolute;
  top: 6.8em;
  right: 10px;
}

#navigation ul,#related h2 {
  margin-top: 0;
  padding-top: 0;
}

#footer {
  padding: 5px 0 5px 160px;
  clear: both;
  background: #D9FFF8;
  font-size: 0.8em;
  color: #030;
}
</style>
</head>
<body id="splash">
<div id="wrapper">
 <div id="header"><h1>Header</h1></div>
 
 <div id="breadcrumb">Sub header</div>
 
 <div id="content-wrapper">
  <div id="content-inner">
  <h2>Header 2</h2>
  <p>this is a test. this is a test. </p>
  <p>this is a test. this is a test. </p>
  <p>this is a test. this is a test. </p>
  <p>this is a test. this is a test. </p>
  <p>this is a test. this is a test. </p>
  <p>this is a test. this is a test. </p>
  <p>this is a test. this is a test. </p>
  <p>this is a test. this is a test. </p>
  <p>this is a test. this is a test. </p>
  <p>this is a test. this is a test. </p>
  
  </div>
 </div>
 
 <div id="navigation"></div>
 
 <div id="related"></div>
 
 <div id="footer">Footer</div>
</div>
</body>
</html>



Header with one column under

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
body {
 width: 600px;
 border-right: 1px solid black;
}
#header {
 background-color: #666;
 border-bottom: 1px solid #333;
}
#columnLeft {
 float: left;
 width: 160px;
 margin-left: 10px;
 padding-top: 1em;
}
#columnRight {
 padding-top: 1em;
 margin: 0 2em 0 200px;
}
#footer {
 clear: both;
 background-color: #ccc;
 padding-bottom: 1em;
 border-top: 1px solid #333;
 padding-left: 200px;
}
</style>
</head>

<body>
  <div id="header">
   <h1>Header header header header header</h2>
  </div>
  <div id="columnSmall">
   <p>small column.</p>
  </div>
  <div id="columnMain">
<p>This is a text. This is a text. This is a text. This is a text. 
This is a text. This is a text. This is a text. This is a text. This is a text. 
This is a text. This is a text. This is a text. This is a text. This is a text. This is a text. This is a text. This is a text. This is a text. This is a text. This is a text. 
This is a text. This is a text. This is a text. This is a text. 
</p>
  </div>
  <div id="columnMedium">
<p>This is a text. This is a text. This is a text. This is a text. 
This is a text. This is a text. This is a text. This is a text. This is a text. 
This is a text. This is a text. This is a text. This is a text. This is a text. This is a text. This is a text. This is a text. This is a text. This is a text. This is a text. 
This is a text. This is a text. This is a text. This is a text. 
</p>
  </div>
  
</body>
</html>



Liquid Design in CSS

 

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitionalt//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  <head>
    <title>Liquid Design in CSS</title>
    <style rel="stylesheet" type="text/css">
div#page {
  width: 95%;
  background-color: #ffffff;
  border-style: solid;
  border-width: 1px;
  border-color: #666666;
  padding: 20px;
  font-size: 12px;
}
</style>
  </head> 
  <body>
    <div id="page">
<h1>Sample Web Page</h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc eleifend, erat id commodo 
placerat, nulla purus bibendum justo, in dictum orci mi vitae nulla. Nullam semper viverra 
nulla. Sed lacinia feugiat eros. Maecenas ullamcorper ligula quis odio. Donec pede massa, 
pharetra sit amet, accumsan a, iaculis egestas, lectus. Etiam ullamcorper elementum wisi. 
Etiam et felis aliquet dui tempus sagittis. Donec dapibus ipsum id leo. Integer est ante, 
imperdiet non, suscipit sit amet, varius a, sem. Integer lobortis wisi id erat. Nullam aliquet 
augue ac elit. Nulla facilisi. Vivamus ligula tortor, molestie at, accumsan quis, semper vitae, 
augue. Praesent pede neque, sollicitudin non, facilisis sed, viverra a, pede. Cras nec urna. 
Curabitur ut metus. Curabitur erat lacus, tempus vitae, elementum nec, pulvinar vel, leo. Sed 
a velit. Proin erat. Donec sem. </p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc eleifend, erat id commodo 
placerat, nulla purus bibendum justo, in dictum orci mi vitae nulla. Nullam semper viverra 
nulla. Sed lacinia feugiat eros. Maecenas ullamcorper ligula quis odio. Donec pede massa, 
pharetra sit amet, accumsan a, iaculis egestas, lectus. Etiam ullamcorper elementum wisi. 
Etiam et felis aliquet dui tempus sagittis. Donec dapibus ipsum id leo. Integer est ante, 
imperdiet non, suscipit sit amet, varius a, sem. Integer lobortis wisi id erat. Nullam aliquet 
augue ac elit. Nulla facilisi. Vivamus ligula tortor, molestie at, accumsan quis, semper vitae, 
augue. Praesent pede neque, sollicitudin non, facilisis sed, viverra a, pede. Cras nec urna. 
Curabitur ut metus. Curabitur erat lacus, tempus vitae, elementum nec, pulvinar vel, leo. Sed 
a velit. Proin erat. Donec sem. </p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc eleifend, erat id commodo 
placerat, nulla purus bibendum justo, in dictum orci mi vitae nulla. Nullam semper viverra 
nulla. Sed lacinia feugiat eros. Maecenas ullamcorper ligula quis odio. Donec pede massa, 
pharetra sit amet, accumsan a, iaculis egestas, lectus. Etiam ullamcorper elementum wisi. 
Etiam et felis aliquet dui tempus sagittis. Donec dapibus ipsum id leo. Integer est ante, 
imperdiet non, suscipit sit amet, varius a, sem. Integer lobortis wisi id erat. Nullam aliquet 
augue ac elit. Nulla facilisi. Vivamus ligula tortor, molestie at, accumsan quis, semper vitae, 
augue. Praesent pede neque, sollicitudin non, facilisis sed, viverra a, pede. Cras nec urna. 
Curabitur ut metus. Curabitur erat lacus, tempus vitae, elementum nec, pulvinar vel, leo. Sed 
a velit. Proin erat. Donec sem. </p>
    </div>
  </body>
</html>



One column: header, content

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style rel="stylesheet" type="text/css">
#wrapper { 
 width: 922px;
}
#header {
 width: 900px;
 color: #333;
 border: 1px solid #ccc;
 height: 100px;
 background-color:#F3F2ED;
}
#content { 
 width: 900px;
 color: #333;
 border: 1px solid #ccc;
 background:#eee;
 height: 350px;
}
</style>
</head>
<body>
<div id="wrapper">
  <div id="header"><h1><a href="">This is a test. </a></h1></div>
  <div id="content"> This is the content </div>
</div>
</body>
</html>



One column with content on the top and menu at the bottom

 

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title></title>
  <style type="text/css">
#content {
  padding: 10px;
  margin-top: 5px;
  margin-bottom: 0px;
  margin-right: auto;
  margin-left: auto;
  background-color: #fff;
  border: 1px solid #000;
  width: 70%;
}
#navBar {
  padding: 0px 10px 0px 10px;
  margin-top: 0px;
  margin-bottom: 5px;
  margin-right: auto;
  margin-left: auto;
  background-color: #fff;
  border-top: 0px;
  border-bottom: 1px solid #000;
  border-left: 1px solid #000;
  border-right: 1px solid #000;
  width: 70%;
  text-align: right;
}
  </style>
</head>

<body>
  <div id="content">
  this is a test. this is a test. this is a test. this is a test. this is a test. 
  this is a test. this is a test. this is a test. this is a test. this is a test. 
  this is a test. this is a test. this is a test. this is a test. this is a test. 
  this is a test. this is a test. this is a test. this is a test. this is a test. 
  this is a test. this is a test. this is a test. this is a test. this is a test. 
  </div>
  <div id="navBar">
  &lt;back |home |next&gt;
  </div>
</body>
</html>



One column with content on the top and menu at the bottom, and margin in between

 
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title></title>
  <style type="text/css">
#content {
  padding: 20px 10px 10px 80px;
  margin-top: 5px;
  margin-bottom: 5px;
  margin-right: auto;
  margin-left: auto;
  background-color: #fff;
  border: 1px solid #000;
  width: 70%;
}
#navBar {
  padding: 0px 10px 0px 10px;
  margin-top: 0px;
  margin-bottom: 5px;
  margin-right: auto;
  margin-left: auto;
  background-color: #fff;
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
  border-left: 1px solid #000;
  border-right: 1px solid #000;
  width: 70%;
  text-align: right;
}
  </style>
</head>

<body>
  <div id="content">
  this is a test. this is a test. this is a test. this is a test. this is a test. 
  this is a test. this is a test. this is a test. this is a test. this is a test. 
  this is a test. this is a test. this is a test. this is a test. this is a test. 
  this is a test. this is a test. this is a test. this is a test. this is a test. 
  this is a test. this is a test. this is a test. this is a test. this is a test. 
  </div>
  <div id="navBar">
  &lt;back |home |next&gt;
  </div>
</body>

</html>



One column with header and footer

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <title>positioning</title>
        <style rel="stylesheet" type="text/css">
h1 {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 20px;
    border-bottom: 1px solid red;
    background: white;
}
div#container {
    position: absolute;
    top: 31px;
    right: 0;
    bottom: 31px;
    left: 0;
    overflow: auto;
    padding: 0 10px;
}
div#footer {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    height: 20px;
    border-top: 1px solid blue;
    background: white;
}
        </style>
    </head>
    <body>
        <h1>A Fixed Heading</h1>
        <div id="container">
            <p>
                Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec eu
                Aenean dictum dolor ut sem.
            </p>
            <p>
                Ut commodo. Sed non nisi at leo aliquet lobortis. Donec a elit vel
                conubia nostra, per inceptos hymenaeos.
            </p>
        </div>
        <div id="footer">
            <p>
                A fixed footer.
            </p>
        </div>
    </body>
</html>



One column with header and footer only

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style rel="stylesheet" type="text/css">
#header {
 width: 900px;
 padding: 10px;
 border: 1px solid #ccc;
 height: 250px;
 margin: 10px 0px 5px 0px;
 background-color:#F3F2ED;
}
#footer { 
 width: 900px;
 border: 1px solid #ccc;
 background: #DAC8BF;
 margin: 0px 0px 10px 0px;
 padding: 10px;
 height: 250px;
}
</style>
</head>
<body>
<div id="wrapper">
  <div id="header"><h1><a href="">this is a test. </a></h1></div>
  <div id="footer"> This is the Footer </div>
</div>
</body>
</html>



One column with two DIV section

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title></title>
  <style type="text/css" media="screen">
#wrapper { 
 width: 922px;
}
#header {
 width: 900px;
 color: #333;
 padding: 10px;
 border: 1px solid #ccc;
 height: 100px;
 margin: 10px 0px 5px 0px;
 background-color:#F3F2ED;
}
#content { 
 width: 900px;
 color: #333;
 border: 1px solid #ccc;
 background:#eee;
 margin: 0px 0px 10px 0px;
 padding: 10px;
 height: 350px;
}
  </style>
</head>
<body>
<div id="wrapper">
  
  <div id="header"><h1><a href="">this is a test. </a></h1></div>
  
  
  <div id="content"> This is the content </div>
  
</div>
</body>
</html>



Single column

 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>1 Column </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style rel="stylesheet" type="text/css" >
#wrapper { 
 width: 922px;
}
#content { 
 width: 900px;
 color: #333;
 border: 1px solid #ccc;
 background:#CCC8B3;
 margin: 10px 0px 10px 0px;
 padding: 10px;
 height: 500px;
}
</style>
</head>
<body>
<div id="wrapper">
  <div id="content"> This is the content </div>
</div>
</body>
</html>



Single Columns with CSS

 
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitionalt//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  <head>
    <title>Single Columns CSS</title>
    <style rel="stylesheet" type="text/css">
.page {
  width: 700px;
  font-size: 12px;
  background-color: #ffffff;
  border-style: solid;
}
.nav {
  font-weight: bold;
  background-color: #e3e3e3;
  padding: 5px;
}
.content {
  padding: 10px;
}
</style>
  </head> 
  <body>
    <div class="page">
    <div class="header"><h1>My Company Name</h1></div>
    <div class="nav"><a href="">Home</a> | <a href="">Products</a> | <a href="">Services</a> | 
    <a href="">About Us</a> | <a href="">Contact Us</a></div>
    <div class="content">
        <h2>Sample Web Page</h2>
           <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc eleifend, erat id 
           commodo placerat, nulla purus bibendum justo, in dictum orci mi vitae nulla. Nullam 
           semper viverra nulla. Sed lacinia feugiat eros. Maecenas ullamcorper ligula quis 
           odio. Donec pede massa, pharetra sit amet, accumsan a, iaculis egestas, lectus. Etiam 
           ullamcorper elementum wisi. Etiam et felis aliquet dui tempus sagittis. Donec dapibus 
           ipsum id leo. Integer est ante, imperdiet non, suscipit sit amet, varius a, sem. 
           Integer lobortis wisi id erat. Nullam aliquet augue ac elit. Nulla facilisi. Vivamus 
           ligula tortor, molestie at, accumsan quis, semper vitae, augue. Praesent pede neque, 
           sollicitudin non, facilisis sed, viverra a, pede. Cras nec urna. Curabitur ut metus. 
           Curabitur erat lacus, tempus vitae, elementum nec, pulvinar vel, leo. Sed a velit. Proin 
           erat. Donec sem. </p>

      </div>
    </div>
  </body>
</html>



Single column with header and footer

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
#outer{
  min-height:100%;
  width:612px;
  position:relative;
}
#header {
  background:#aaa;
  height:40px;
  margin-left:6px;
  margin-right:6px;
}
#footer {
  position:absolute;
  bottom:0;
  left:0;
  background:#ccc;
  height:40px;
  width:98%;
}
#clearfooter{
    clear:both;
    height:40px;
}
</style>
</head>
<body>
<div id="outer">
  <div id="header">Header</div>
    <p>Content</p>
  <div id="clearfooter"></div>
  <div id="footer">Footer</div>
</div>
</body>
</html>