By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,648 Members | 1,203 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,648 IT Pros & Developers. It's quick & easy.

Inline block with width and height?

P: n/a
An image like this one
<html>
test1<img src="" style="width:100;height:100"/>test2
</html>
is in line with the text and has a width and height.

How can I get the same with a span or div instead of an image?

This does NOT work:
<html>
test1
<span style="display:inline-block;background:red;width:100;height:100">block
</span>
test2
</html>

JMS
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Jens wrote:
An image like this one
<html>
test1<img src="" style="width:100;height:100"/>test2
100 what? Units are required (as is the <title> element).
</html>
is in line with the text and has a width and height.

How can I get the same with a span or div instead of an image?
Images are replaced inline elements, they have have a height and width.
This does NOT work:
style="display:inline-block;background:red;width:100;height:100">block


What browser are you testing with? As far as I know, only Opera supports
inline-block (so far).

In most browsers you have to fiddle with float to achive things of this
nature.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.