ghurty Posted July 1, 2009 Share Posted July 1, 2009 How can I have two columns (each row has text and image), but with everything in the same DIV? Thanks Link to comment https://forums.phpfreaks.com/topic/164415-how-can-i-have-two-columns-each-row-has-text-and-image-with-one-div/ Share on other sites More sharing options...
haku Posted July 2, 2009 Share Posted July 2, 2009 Here is an example: HTML: <div id="columns"> <p>some text</p> <span><img src="img.jpg" alt="image" /></span> <p>some more text</p><span> <img src="another/img.jpg" alt="another image" /></span> </div> CSS: #columns { width: 1000px; margin: 0 auto; overflow:auto; } #columns p { width:50%; float:left; clear:both; } #columns span { width:50%; float:right; } You'll have to adjust the numbers depending on the size of your image and stuff. But this is a basic outline. Link to comment https://forums.phpfreaks.com/topic/164415-how-can-i-have-two-columns-each-row-has-text-and-image-with-one-div/#findComment-867550 Share on other sites More sharing options...
arneman Posted July 10, 2009 Share Posted July 10, 2009 Or use a table with 2 columns? Link to comment https://forums.phpfreaks.com/topic/164415-how-can-i-have-two-columns-each-row-has-text-and-image-with-one-div/#findComment-872460 Share on other sites More sharing options...
haku Posted July 10, 2009 Share Posted July 10, 2009 Columns shouldn't be used for layout purposes. Link to comment https://forums.phpfreaks.com/topic/164415-how-can-i-have-two-columns-each-row-has-text-and-image-with-one-div/#findComment-872479 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.