div in a div with class name : div « Tags « HTML / CSS






div in a div with class name

     

<html>
<head>
<style type="text/css">
body {
  background-color: #fff;

}
div.imgholder {
  float: left;
  background: red; 
  margin: 0 7px 7px 0;

}
 

div.imgholder div {
    background: blue; 
    padding: 0 6px 6px 0;
}
div.imgholder img { 
   display: block;
   position: relative;
   background-color: #fff;
   border: 1px solid #666;
   padding: 2px;
} 
</style>

</head>
<body>
   <div class="imgholder">
    <div>
      <img src="http://www.java2s.com/style/logo.png" alt="Photo" /> </div>
    </div>
    <h2>Adipiscing Elit</h2>


</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.Default layout for div tags
22.The dialogue div element is aligned vertically and horizontally, no matter what the size of the browser window.
23.div for header and body
24.Grouping Elements Using the div Element
25.Two boxes with div tags
26.HTML divisions
27.Division tag
28.div with id style
29.div with class name
30.div.className (tag.className)
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