473,729 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Span/background-image IE6 bug?

I have a span containing two words. Eg.

<span>Avant Garde</span>

Using CSS, I pad the text to the right and assign a background-image. Eg.

span {
padding: 0 3px 0 11px;
background: url(images/tagbull.gif) no-repeat 0px 2px;
}

The tag renders as expected...unle ss the line wraps in the middle of the
two words. Then the background-image doesn't appear in IE6, but it
renders fine in Firefox. Is this a browser bug?

To see an example, browse the following URL with IE6 and expand the "10
Tags" link: <http://arty.me.uk/2006/01/04/announcing-avantist/>
--
Walker
arty.me.uk
Jan 5 '06 #1
16 14627

Walker wrote:
I have a span containing two words. Eg.

<span>Avant Garde</span>
To see an example, browse the following URL with IE6 and expand the "10
Tags" link: <http://arty.me.uk/2006/01/04/announcing-avantist/>


I think you should try and mark it up as a list as seeing it is a list.
Anyways backgound images and inline elements don't always play well.

Jan 5 '06 #2
logic_earth wrote:
Walker wrote:
I have a span containing two words. Eg.

<span>Avant Garde</span>


To see an example, browse the following URL with IE6 and expand the "10
Tags" link: <http://arty.me.uk/2006/01/04/announcing-avantist/>


I think you should try and mark it up as a list as seeing it is a list.
Anyways backgound images and inline elements don't always play well.


Don't play well in IE6 or current browsers in general? The code is
valid, the outcome should be obvious, and Konqueror, Opera and Firefox
all render it as expected. :)

(I was playing around forever with an unordered list solution before
choosing the span option, but I had some difficult that I can't recall.
I'll have a play around with the idea again anyway.)
--
Walker
arty.me.uk
Jan 5 '06 #3
Els
Walker wrote:
span {
padding: 0 3px 0 11px;
background: url(images/tagbull.gif) no-repeat 0px 2px;
}

The tag renders as expected...unle ss the line wraps in the middle of the
two words. Then the background-image doesn't appear in IE6, but it
renders fine in Firefox. Is this a browser bug?


I'm not sure it's a bug, but it is a difference, yes.
The thing is, that when you state 'left' or '0px' for the horizontal
position of the background-image, IE assumes 'left' of the entire
span. When the span is divided over 2 lines, the left side of the
whole span, is on the left of the second line. Out of sight when you
set it 2px from the top.

A workaround might be to have two spans:

<span><span> </span>some words</span>

span span {
padding: 0 3px 0 11px;
background: url(images/tagbull.gif) no-repeat 0px 2px;
}

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Magnum - Walking The Straight Line
Jan 5 '06 #4
On Thu, 05 Jan 2006 22:47:38 +0100, Els <el*********@ti scali.nl> wrote:
Walker wrote:
The tag renders as expected...unle ss the line wraps in the middle of the
two words. Then the background-image doesn't appear in IE6, but it
renders fine in Firefox. Is this a browser bug?


A workaround might be to have two spans:

<span><span> </span>some words</span>

span span {
padding: 0 3px 0 11px;
background: url(images/tagbull.gif) no-repeat 0px 2px;
}


Or to prevent the line break (if the span is just a two or three words
anyway).
--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
Jan 5 '06 #5
Els wrote:
Walker wrote:

span {
padding: 0 3px 0 11px;
background: url(images/tagbull.gif) no-repeat 0px 2px;
}

The tag renders as expected...unle ss the line wraps in the middle of the
two words. Then the background-image doesn't appear in IE6, but it
renders fine in Firefox. Is this a browser bug?

I'm not sure it's a bug, but it is a difference, yes.
The thing is, that when you state 'left' or '0px' for the horizontal
position of the background-image, IE assumes 'left' of the entire
span. When the span is divided over 2 lines, the left side of the
whole span, is on the left of the second line. Out of sight when you
set it 2px from the top.

A workaround might be to have two spans:

<span><span> </span>some words</span>

span span {
padding: 0 3px 0 11px;
background: url(images/tagbull.gif) no-repeat 0px 2px;
}


Thank-you! I've tested the code offline and it fixes the problem and
renders identically in Opera and Firefox. :) I just had to alter the
padding of outer and inner spans because, being only applied to the
inner span, it was pushing the text (now in the outer span) to the right.

I've spent so many hours fighting browser inconsistencies (taming lists,
getting to grips with the box model, etc.) without relying on hacks that
it seems amazing that something like this had me stumped. And I'd never
have thought of this solution. Look me up if you're ever in Manchester
and I'll buy you a pint. ;-)
--
Walker
arty.me.uk
Jan 5 '06 #6
Walker wrote:
Els wrote: // Thank-you! I've tested the code offline and it fixes the problem and
renders identically in Opera and Firefox. :) I just had to alter the
padding of outer and inner spans because....


I knew there was something I forgot to mention. IE6 ignored the inner
span because it saw nothing but whitespace. So I just inserted an
&nbsp; and that fixed it. Eg.

<span><span>&nb sp;</span>some words</span>

--
Walker
arty.me.uk
Jan 5 '06 #7
Els
Barbara de Zoete wrote:
On Thu, 05 Jan 2006 22:47:38 +0100, Els <el*********@ti scali.nl> wrote:
Walker wrote:
The tag renders as expected...unle ss the line wraps in the middle of the
two words. Then the background-image doesn't appear in IE6, but it
renders fine in Firefox. Is this a browser bug?


A workaround might be to have two spans:

<span><span> </span>some words</span>

span span {
padding: 0 3px 0 11px;
background: url(images/tagbull.gif) no-repeat 0px 2px;
}


Or to prevent the line break (if the span is just a two or three words
anyway).


Yup - that would work very well too <g>
(I hadn't seen the actual situation and had a much longer span in my
imaginary example problem ;-) )

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: INXS - Bitter Tears
Jan 6 '06 #8
Walker wrote:

I was playing around forever with an unordered list solution before
choosing the span option, but I had some difficult that I can't recall.

See <http://css.maxdesign.c om.au/listamatic/>

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jan 6 '06 #9
Jim Moe wrote:
Walker wrote:
I was playing around forever with an unordered list solution before
choosing the span option, but I had some difficult that I can't recall.


See <http://css.maxdesign.c om.au/listamatic/>


Been there, done that. Inline lists with background-images and padding
are afflicted by more problems in IE6 than the span method I chose.
Exactly the same rendering problem was occurring on the final list item
on a line for example, and getting the padding and margins consistent
across all browsers was more trouble than it was worth.

IE6 just always wanted to do something differently. With this span
solution, I've got the faux list rendering how I would like across the
big three browsers...oh, and Konqueror too.
--
Walker
arty.me.uk
Jan 6 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
12430
by: kAldam | last post by:
I am currently using IE 6.0 and 5.5 and the scenario is the following. I have a span that contains text, and the span is beign contained by a table cell (this is the way thing need to be in my application). I have an issue when the span has a heigth less than 18px (meaning height of the span, there is only one line of text and the height of the text is less than 18). The issue is that I start getting a padding, I add a color background to...
2
1932
by: Mr. Clean | last post by:
Why would this work: <html> <head> <title>Page 1</title> </head> <body style="background:#C2BFA5;"> <span style="text-align: center; border:thin inset; position:absolute; left:14px;
0
1666
by: JimO | last post by:
I'm new to CSS and I'm trying to figure out the difference between the Header tags, div, span, and p tags as they relate to style sheets. They each render slightly different in the browser and accept different styles. I was wondering if there is any hard and fast rule or if it's just a matter of playing around and discovering ones preferences. Thanks, Jim <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
2973
by: JimO | last post by:
I'm new to CSS and I'm trying to figure out the difference between the Header tags, div, span, and p tags as they relate to style sheets. They each render slightly different in the browser and accept different styles. I was wondering if there is any hard and fast rule or if it's just a matter of playing around and discovering ones preferences. Thanks, Jim
4
23470
by: jawolter | last post by:
I have text that is too long to nicely fit on a given page, so I want to add ellipses to the end that dynamicaly resize based on the person resizing the page width. If you hover it would show the full text, using a title attribute I believe. It works for a div, but not a span... any ideas? Here's a snippet that I'm working on: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2
3951
by: ricky | last post by:
Hello, If anyone could help me with this I would highly appreciate it. I've tried everything and nothing works. What I am trying to do is so damn basic and it's just frustrating that it seems there's no support for this. Either that or I'm doing something wrong. Well, enough venting, here's what I need. Using this sample XML file (test.xml):
2
1373
by: reproots | last post by:
hi there, i am having trouble with a span command and would like to know if someone can help me, or point me in the correct direction. basically, i want a little textbox to pop up when a mouse rolls over text within a paragraph (without breaking the text up). my knowledge is pretty basic, but, by looking at other websites, i have been able to put together the following javascript/CSS command. however, it only works with a DIV command,...
5
5490
by: David Housman | last post by:
Hello, I'm trying to implement a navigation bar with a ul in css. The code is a template, but i'm customizing. I can handle just text in each block, but i want the first block to have an image and then text, which I'm doing with a span element. I think i need it that way to handle text positioning of the text. So there's an anchor block, and inside4 that i'm putting an image and a span block.
2
3718
by: pbd22 | last post by:
Hi. I have been wrestling with getting a span (or a few) to live inside a few divs. I want to put padding around the span but it seems to move independent of the divs even though there is no float. I am wondering if display:block is messing stuff up? Or, something else? do you see what I am doing wrong?
0
8921
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9427
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9284
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9148
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8151
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4528
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4796
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2683
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2165
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.