| | |
Putting divs side by side
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Apr 2009
Posts: 15
Reputation:
Solved Threads: 0
I am trying to create a kind of grid of divs but i cannot get it to work.
I am a newbie at this and still learning. I have been on many websites but still no luck.
My html is
The CSS is
When the page is rendered the divs are all over the place really. Im thinking of going back to a table but i would prefer a more flexible solution
I am a newbie at this and still learning. I have been on many websites but still no luck.
My html is
HTML and CSS Syntax (Toggle Plain Text)
<div id="pitchdiv" class="dropZoneContainer"> <div id="gk" class="wrapper"> <div id="gk1" class="dropZone" /> </div> <div id="def" class="wrapper"> <div id="def1" class="dropZone" /> <div id="def2" class="dropZone" /> <div id="def3" class="dropZone" /> <div id="def4" class="dropZone" /> </div> <div id="mid" class="wrapper"> <div id="mid1" class="dropZone" /> <div id="mid2" class="dropZone" /> <div id="mid3" class="dropZone" /> <div id="mid4" class="dropZone" /> </div> <div id="str" class="wrapper"> <div id="str1" class="dropZone" /> <div id="str2" class="dropZone" /> </div> </div>
HTML and CSS Syntax (Toggle Plain Text)
.wrapper { width:380px; height:148px; margin-bottom:1px; margin-top:1px; border:solid 1px black; } .dropZone { background-color:Transparent; height:120px; width:80px; float:left; } .dropZoneContainer { background-image:url(./images/footballpitch2port.png); top:100px; left:600px; height:600px; width:382px; position:absolute; }
When the page is rendered the divs are all over the place really. Im thinking of going back to a table but i would prefer a more flexible solution
0
#2 Oct 13th, 2009
easy way to make them appear next to each other is give them a float: left and make sure they can fit next to each other comfortably. this should help
92% of all statistics are made up on the spot.
If you found a post helpful, please click the "give XXX reputation" link, to show your appreciation to those who helped you. Thanks! :D
If you found a post helpful, please click the "give XXX reputation" link, to show your appreciation to those who helped you. Thanks! :D
•
•
Join Date: Jan 2009
Posts: 100
Reputation:
Solved Threads: 16
1
#4 Oct 14th, 2009
You float div are the child of the main wrapper and it float in its parent. Not the wrapper and 'dropzoneContainer'. Also, wrapper and dropzoneContainer has still linebreak and they generate break line around them. So you must float them. Then, you give the wrapper to 380px width. There is 3 wrapper div and dropzoneContainer which has 382px width. So, there is no enough space to appear next to each. Try this:
Sorry for my English skill and good luck to you.
HTML and CSS Syntax (Toggle Plain Text)
CSS: .wrapper { width:20%; height:148px; margin-bottom:1px; margin-top:1px; border:solid 1px black; float:left; background:red } .dropZone { background: green; height:120px; width:80px; float:left; } .dropZoneContainer { background:blue; height:600px; width:37%; float: left }
![]() |
Similar Threads
- Printing four different shapes side by side. (C++)
- How Do I Place Two Banners side by side? (PHP)
- html Image List with divs shows incorrectly when opened in word (HTML and CSS)
- difference between memory w/black chips on one side and both sides? (Motherboards, CPUs and RAM)
- Side by side windows in Internet Explorer (Web Browsers)
Other Threads in the HTML and CSS Forum
- Previous Thread: Extending the box model?
- Next Thread: IE problems with image allignment.
Views: 543 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for HTML and CSS
2002 appointments asp background backgroundcolor beta browser bug calendar cart center cgi code codeinjection corporateidentity create css deleted design development displayimageinsteadofflash dreamweaver drupal emailmarketing epilepsy explorer firefox flash font fonts form format free frontpage google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft missing mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization perl pnginie6 positioning problem scroll seo shopping studio swf swf. templates textcolor theme timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7 wordpress xml xsl





