473,398 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

inline element background image with IE

On my site, I use a background image of a small arrow to denote links
that lead away from my site. This page has four such links in the first
section:

http://tranchant.plus.com/notes/cable-wrap

The links are coded thus:

<a class="external" href="url">blah</a>

with:

a.external {
background: transparent url('/images/ext') no-repeat 100% 55%;
padding-right: 11px;
}

All works fine, except in IE (surprise) when the image is not shown if
the element either goes across two lines or starts at the beginning of a
line. Load up the above URL in IE and resize the window to see the effect.

Is this a known IE bug (I expect so) and is there anything I can do
about it (I guess not...)?

--
Mark.
http://tranchant.plus.com/
Jul 20 '05 #1
3 5615
Mark Tranchant <ma**@tranchant.plus.com> wrote:
On my site, I use a background image of a small arrow to denote links
that lead away from my site. This page has four such links in the first
section:
http://tranchant.plus.com/notes/cable-wrap

<a class="external" href="url">blah</a>

a.external {
background: transparent url('/images/ext') no-repeat 100% 55%;
padding-right: 11px;
}
By changing the 55% to 0 you can see what IE is doing...
All works fine, except in IE (surprise) when the image is not shown if
the element either goes across two lines or starts at the beginning of a
line. Load up the above URL in IE and resize the window to see the effect.
It's putting the background-image at the rightmost position possible
in the inline boxes generated by the element, regardless of whether
this is at the end of the element or not.

You have to admire the (perverse) logic behind this behaviour. :-(
Is this a known IE bug (I expect so) and is there anything I can do
about it (I guess not...)?


Can't think of anything you can do. I had a little play with a nested
span and a repeating background image but ran into other bugs. :-(

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #2
Els
Mark Tranchant wrote:
On my site, I use a background image of a small arrow to denote links
that lead away from my site. This page has four such links in the first
section:

http://tranchant.plus.com/notes/cable-wrap

The links are coded thus:

<a class="external" href="url">blah</a>

with:

a.external {
background: transparent url('/images/ext') no-repeat 100% 55%;
padding-right: 11px;
}

All works fine, except in IE (surprise) when the image is not shown if
the element either goes across two lines or starts at the beginning of a
line. Load up the above URL in IE and resize the window to see the effect.

Is this a known IE bug (I expect so) and is there anything I can do
about it (I guess not...)?


If you replace 55% by .55em, the arrow will be shown on the
end of the first line of the wrap, at the same height as
when it doesn't wrap.
In IE 55% apparently means at 55% of the two lines together.
With .55em you have 55% of only one line. It still doesn't
appear at the end of the element, but it's better than nothing?

As for not showing the arrow when the element starts at the
beginning of a line, just add padding-left:1px, and the
arrows show. (Don't ask me why...)

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -

Jul 20 '05 #3
Els
Els wrote:
Mark Tranchant wrote:
On my site, I use a background image of a small arrow to denote links
that lead away from my site. This page has four such links in the
first section:

http://tranchant.plus.com/notes/cable-wrap

The links are coded thus:

<a class="external" href="url">blah</a>

with:

a.external {
background: transparent url('/images/ext') no-repeat 100% 55%;
padding-right: 11px;
}

All works fine, except in IE (surprise) when the image is not shown if
the element either goes across two lines or starts at the beginning of
a line. Load up the above URL in IE and resize the window to see the
effect.

Is this a known IE bug (I expect so) and is there anything I can do
about it (I guess not...)?


Steve's answer gave me the idea to do this:

<a class="external"
href="http://www.fastech.ch/gb/VELCRO/Velcro%20Story.htm">why
I shouldn’t call it velcro<span>&nbsp;&nbsp;</span></a>

and in the stylesheet, change

#content a.external {
background:transparent url('../images/ext.png') no-repeat
100% 55%;
padding-right: 11px;
padding-left:1px;
}

to

#content a.external span{
background:transparent url('../images/ext.png') no-repeat
0% 55%;
}

and

#content a.external:hover {
background:transparent url('../images/exth.png') no-repeat
100% 55%;
background-color: #ffcccc;
}

to

#content a.external:hover {
background-color: #ffcccc;
}
#content a.external:hover span{
background:transparent url('../images/exth.png') no-repeat
100% 55%;
}

I've only tested in IE5 and 6, NS7.1 and Opera 7.5, no
problems with this method, other than
<span>&nbsp;&nbsp;</span> just being ugly code...

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -

Jul 20 '05 #4

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

Similar topics

46
by: DJ WIce | last post by:
Hi all, I did make a script/css thing to replace the contextmenu on the website with a new one: http://www.djwice.com/contextmenu.html It works nice in MSIE, but on Netscape (and probable...
3
by: Aaron | last post by:
Hi, I'm trying to use style sheets instead of tables for layout, but I'm not sure on how to do something... I have a div (100% width) containing 3 other divs. Each needs to be lined up next to...
1
by: Johannes Theile | last post by:
Hi, is it possible to show the bullets in a list (ul), although it is possitioned as an inline element? Greetings, Johannes
12
by: Stanimir Stamenkov | last post by:
Here are two cases regarding inline-level elements' line-height, padding and background, which I doesn't understand: <div style="background: black; color: white; line-height: 1.5">...
1
by: Jens | last post by:
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...
6
by: axlq | last post by:
I've spent most of the day struggling with what I thought would be a trivial problem. I have a hidden element that appears, outside of the normal flow, when the mouse hovers over an inline...
3
by: Jannette | last post by:
I've got this to finally work in IE (its only taken me 2 days solid), but now mozilla isn't displaying the text on the same line as the image. I'm a newby at CSS, and I've think I've worked on trying...
7
by: massic80 | last post by:
Hi everybody! I'm making a page for an exam at uni. In two DIV blocks of it there should appear (and disappear) some "icons", due to XML messages, so I dunno how many of them should I can obtain;...
5
by: GluteHam | last post by:
OK, so here's a new one for the group... I have the two following classes: .ratings_link { display: block; background: #ffeec1 url(image.gif) no-repeat center right; font: bold Arial,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...

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.