html - Positioning divs with css using absolute positioning -


i know noob question, can't figure out! i'm laying out page our intranet , need position divs side side. each container different item, containers have same structure, header, descriptive text, , image. adding items given me. page i'm creating employees sell items. here css , image of i'm trying achieve. please let me know if doesn't make sense, smart guys have proven in past, i'm sure idea.

.wrapper {     width: 1260px;     height: 900px;     margin: 0px auto;     position: relative; } .container {     width: 400px;     height: 400px;     margin: 10px;     position: absolute; } .itemtext {     width: 350px;     height: 190px;     padding: 0px;     position: absolute;     top: 25px;     left: 25px; } .itemhead {     padding: 0px;     margin: 0px; } .itemdesc {     padding: 10px;     margin: 0px; } .itemthumb {     width: 350px;     height: 150px;     position: absolute;     bottom: 25px;     left: 25px; } 

my html

<!doctype html> <html lang="en"> <head>     <meta charset="utf-8">     <link rel="stylesheet" href="css/reset.css">     <link rel="stylesheet" href="css/text.css">     <link rel="stylesheet" href="css/style.css">     <title>document</title> </head> <body>     <div class="wrapper">         <div class="container">             <div class="itemtext">                 <div class="itemhead">                     <p>lorem ipsum.</p>                 </div>                 <div class="itemdesc">                     <p>lorem ipsum dolor sit amet, consectetur adipisicing elit. iusto, placeat, aliquid tempore harum similique quo deleniti velit eum labore est?</p>                 </div>             </div>             <div class="itemthumb"></div>         </div>         <div class="container">             <div class="itemtext">                 <div class="itemhead">                     <p>lorem ipsum.</p>                 </div>                 <div class="itemdesc">                     <p>lorem ipsum dolor sit amet, consectetur adipisicing elit. iusto, placeat, aliquid tempore harum similique quo deleniti velit eum labore est?</p>                 </div>             </div>             <div class="itemthumb"></div>         </div>         <div class="container">             <div class="itemtext">                 <div class="itemhead">                     <p>lorem ipsum.</p>                 </div>                 <div class="itemdesc">                     <p>lorem ipsum dolor sit amet, consectetur adipisicing elit. iusto, placeat, aliquid tempore harum similique quo deleniti velit eum labore est?</p>                 </div>             </div>             <div class="itemthumb"></div>         </div>     </div> </body> </html> 

basic layout

don't position containers absolutely.

.container { width: 400px; height: 400px; margin: 10px; position: relative; float:left; }

at end of last container div, you'll need div clear: left;

<div style="clear:left;"></div> 

now when add more div's, auto float, , container cleared.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -