Given this HTML:
<div>foo</div><div>bar</div><div>baz</div>
How do you make them display inline like this:
foo bar baz
not like this:
foo
bar
baz
Given this HTML:
<div>foo</div><div>bar</div><div>baz</div>
How do you make them display inline like this:
foo bar baz
not like this:
foo
bar
baz
I know people say this is a terrible idea, but it can in practice be useful if you want to do something like tile images with comments underneath them. e.g. Picasaweb uses it to display the thumbnails in an album.
See for example/demo http://closure-library.googlecode.com/svn/trunk/closure/goog/demos/inline_block_quirks.html ( class goog-inline-block ; I abbreviate it to ib here )
Given that CSS, set your div to class ib, and now it's magically an inline block element.
Try writing it like this:
Having read this question and the answers a couple of times, all I can do is assume that there's been quite a bit of editing going on, and my suspicion is that you've been given the incorrect answer based on not providing enough information. My clue comes from the use of
br
tag.Apologies to Darryl. I read class="inline" as style="display: inline". You have the right answer, even if you do use semantically questionable class names ;-)
The miss use of
br
to provide structural layout rather than for textual layout is far too prevalent for my liking.If you're wanting to put more than inline elements inside those
divs
then you should be floating thosediv
s rather than making them inline.Floated divs:
Inline divs:
If you're after the former, then this is your solution and lose those
br
tags:note that the width of these divs is fluid, so feel free to put widths on them if you want to control the behavior.
Thanks, Steve
That's something else then:
Here is html code as per your requirements :
You've two way to do this
display:inline-block;
float:left;
so you've to change display property
display:inline-block;
forcefullyExample one
Example two
http://jsfiddle.net/f8L0y5wx/