Default layout for div tags : div « Tags « HTML / CSS






Default layout for div tags

      

<!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 type='text/css'>
body {
    background: lightyellow;
    font: 12px sans-serif;
}
div {
    width: 100px;
    height: 100px;
    border: 1px solid rgb(200, 200, 200);
}
div#one {
    background: pink;
}
div#two {
    background: lightblue;
}
div#three {
    background: yellowgreen;
}
div#four {
    background: orange;
}
</style>


    </head>
    <body>
        <p>
            Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed
            sit amet sem quis orci malesuada facilisis. Nulla dictum malesuada
            magna. Quisque ac est et nibh porta nonummy. Cras pede tortor,
            lacinia et, eleifend quis, consequat vel, odio. Proin urna mi,
            facilisis et, consequat eu, scelerisque vel, lacus. Nunc turpis.
            Vestibulum sed felis.
        </p>
        <div id='one'></div>
        <div id='two'></div>
        <div id='three'></div>
        <div id='four'></div>
    </body>
</html>

   
    
    
    
    
    
  








Related examples in the same category

1.'div' Example
2.DIV color: white;
3.div::before content: "I said, \"Hello, world!\"";
4.div::before color: white;
5.div with id selector
6.Using div as img tag
7.This div stretches across the whole window.
8.div content: "This string is placed inside of all div elements.";
9.Using div to layout table elements
10.Div element
11.Div color: #676767;
12.Div based multi-column
13.Div color: red;
14.Div color: #FEF9ED;
15.DIV overflow: hidden;
16.DIV as container
17.Using two Nested DIV to do the layout
18.DIV color: #9D9C6A;
19.DIV color: #505050;
20.Nested div box
21.The dialogue div element is aligned vertically and horizontally, no matter what the size of the browser window.
22.div for header and body
23.Grouping Elements Using the div Element
24.Two boxes with div tags
25.HTML divisions
26.Division tag
27.div with id style
28.div with class name
29.div.className (tag.className)
30.div in a div with class name
31.Use DIV as wrapper
32.Click to show or hide DIV section
33.Click to show and hide DIV content (IE only)
34.Block divider
35.'nowrap' is similar to the 'pre' element