[RESOLVED] How to make a div become inline-block?
Also if I remove the anchor it works in Chrome for some reason.
text on left.
<a href='#'><div id='icon'></div></a>
text on right.
o.style.width = '44px';
o.style.height = '44px';
o.style.display = 'inline-block';
o.style.backgroundColor = '#888';
Some browsers render extra margin and padding on elements by default. Using a CSS reset should help eliminate cases like this.
I'm going to guess if you add some CSS to your anchor, it should correct it.
<a href='#' style="display: block;"><div id='icon'></div></a>
I'm always up for networking with fellow web professionals. Connect with me on LinkedIn
if you like!
Nope, didn't do anything.
I just want to change a div from block to inline-block, but Chrome and IE don't seem to support something this simple?
The HTML spec doesn't actually allow DIV elements inside A elements, so my guess is that you'll never get predicable behavior across browsers. You'll probably need to change that DIV to a SPAN.
Wow I didn't know that. I've been using divs inside anchors all over the place for years. I'll use spans, thanks
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread