467,116 Members | 1,242 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,116 developers. It's quick & easy.

Inline block with width and height?

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
  • viewed: 3243
Share:
1 Reply
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.

Similar topics

3 posts views Thread by Aaron | last post: by
5 posts views Thread by Haines Brown | last post: by
5 posts views Thread by CES | last post: by
7 posts views Thread by massic80 | last post: by
14 posts views Thread by Haines Brown | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.