+ 4

Please help me with div boxes

How to display two <div> boxes inline in CSS?

12th Feb 2017, 7:54 AM
Samuel Ć Ășr
Samuel Ć Ășr - avatar
3 Answers
+ 2
@Varun Moghe: Your answer is ugly... not false, but not the better way, and almost unreadable as is ( hardly but possible for experimented people, but quitely impossible for a beginner :P ). You should indent your code ( edit: and break lines, obviously ), mainly if this is to be read by others ^^ @Samuel Sur: As suggested by @Robin Deckert, for give the layout placement behaviour of a <span> ( inline ) element to a <div> ( block ) one, you need to set the css property 'display' of your <div> to an inlined type value ( 'inline', 'inline-block' ).
14th Feb 2017, 8:23 AM
visph
visph - avatar
+ 1
why don't you use the <span> tag
12th Feb 2017, 1:58 PM
Robin Deckert
Robin Deckert - avatar
0
<style type="text/css"> div.inline { float:left; } .clearBoth { clear:both; } </style> <div class="inline">1<br />2<br />3</div> <div class="inline">1<br />2<br />3</div> <div class="inline">1<br />2<br />3</div> <br class="clearBoth" />
12th Feb 2017, 8:08 AM
Varun Moghe
Varun Moghe - avatar