473,402 Members | 2,064 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,402 software developers and data experts.

Gecko/IE problem

I'm making a CSS menu and I have a problem (yet another "Gecko/IE
different behaviour with the same code" problem).

This menu uses unordered lists, with li elements that contain
hyperlinks. The width of the ul is fixed, and I've set the width of
the li and a elements to 100%. I've also set a 10px left and right
padding to the links, and here is the problem: in Gecko, the hyperlink
sticks out from the li element that contains it, because of the
padding, whereas in Explorer it doesn't. If I remove the "width: 100%"
from the hyperlink style, then the problem is solved but only
partially, because IE treats as a link only the text inside the
<a></a> tags, but I want all the "bar" to be clickable. I've put a
simple code snip below.

Any help to overcome this problem would be appreciated.

<html>
<head>
<STYLE type=text/css>
..listyle{
float: left;
display: block;
width: 100%;
border-top-width: 1px;
border-top-style: solid;
border-top-color: #0000FF;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #0000FF;
}
..ulstyle {
width: 100px;
}
..astyle {
background: #FF0000;
display: block;
width: 100%;
padding-left: 10px;
padding-right: 10px;

text-decoration: none;
}
</STYLE>
</head>
<body>
</body>
In IE the hyperlink doesn't stick out from the &lt;li&gt; element. In
Gecko, it does.<P>
<ul class="ulstyle">
<li class="listyle"><a class="astyle"
href="http://www.google.com">test</a></li>
</ul>
</html>
Jul 21 '05 #1
6 3214
Els
Prototipo wrote:
I'm making a CSS menu and I have a problem (yet another "Gecko/IE
different behaviour with the same code" problem).

This menu uses unordered lists, with li elements that contain
hyperlinks. The width of the ul is fixed, and I've set the width of
the li and a elements to 100%. I've also set a 10px left and right
padding to the links, and here is the problem: in Gecko, the hyperlink
sticks out from the li element that contains it, because of the
padding, whereas in Explorer it doesn't. If I remove the "width: 100%"
from the hyperlink style, then the problem is solved but only
partially, because IE treats as a link only the text inside the
<a></a> tags, but I want all the "bar" to be clickable.


Don't set a width to the li, just 100% and display:block to the a.

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 21 '05 #2
Els wrote:

Don't set a width to the li, just 100% and display:block to the a.


First of all, thanks for your reply.

I don't know if I've understood you correctly. Now I have already the li
with width:100% and display:block in the hyperlink style. If I don't set
width:100% to the li, Firefox doesn't make it fill the ul element (which
has a fixed width).

Sorry if I didn't understand you right.
Jul 21 '05 #3
Prototipo wrote:
Els wrote:

Don't set a width to the li, just 100% and display:block to the a.


First of all, thanks for your reply.

I don't know if I've understood you correctly. Now I have already the li
with width:100% and display:block in the hyperlink style. If I don't set
width:100% to the li, Firefox doesn't make it fill the ul element (which
has a fixed width).

Sorry if I didn't understand you right.


use a doctype, and read :
http://www.maxdesign.com.au/presentation/listutorial/

gl
martin
Jul 21 '05 #4
Els
Prototipo wrote:
Els wrote:

Don't set a width to the li, just 100% and display:block to the a.


First of all, thanks for your reply.

I don't know if I've understood you correctly. Now I have already the li
with width:100% and display:block in the hyperlink style. If I don't set
width:100% to the li, Firefox doesn't make it fill the ul element (which
has a fixed width).

Sorry if I didn't understand you right.


Well, if you don't set float:left; display:block; and width:100%; to
the <li> element, it actually will expand to the width of the <ul>.

It's the display:block and width:100% on the <a> element that makes
the entire <li> element clickable.

I see now though how the padding makes the <a> elements stick out. On
my own site I solved that by not setting a right padding (no need),
and replacing the left padding by text-indent. In your case:
..astyle{text-indent:10px;}

Another option is to use padding, and not style the <li>, only the
<a>. The difference in width between Gecko and IE will be gone once
you use a strict doctype, so that IE uses standards mode instead of
quirks mode.

Reason I chose for text-indent instead of padding, is that IE5 doesn't
behave like IE6 in standards mode, and will show the menu narrower
than the other browsers.

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 21 '05 #5
Els wrote:
Well, if you don't set float:left; display:block; and width:100%; to
the <li> element, it actually will expand to the width of the <ul>.

....

Thanks a lot for your reply, I'm using text-indent now instead of
padding and it works perfectly. Thanks Martin for the link, too.

Regards,
Diego
Jul 21 '05 #6
Aslo check out http://www.alistapart.com/articles/taminglists/

Greetings
-- Markus

Jul 21 '05 #7

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

Similar topics

15
by: Peter Bremer | last post by:
Hi all, I've written this little piece of code, which doesn't seem to work in Mozilla 1.5. I haven't tried it on other Gecko browsers, but I've found some indication that Netscape 6+ has the...
1
by: F. Da Costa | last post by:
Hi, In the html (as shown below) there are some <a> tags I need to move into a map. This is no problem (in Gecko) using the js below. However, IE 5+ (nor 6) does not want to play. It gives me...
7
by: F. Da Costa | last post by:
Hi, I' looking to retrieve ProdName1 form the <tr> below. <tr id="1-1-1" class="even"> <td> <div class="tier4"> <a href="#" class="leaf"></a> ProdName1 </div>
2
by: Rainer Birkenmaier | last post by:
Hi again, This float-thing with IE is really killing me ... anyway here two new questions: 1) Check out http://birkenmaier.org/a.php If you display this using IE the margin between the...
3
by: Kyle Matthews | last post by:
Hello all, I am currently working on a 2 column layout in which the smaller column is fixed at 100px, and the larger column takes up the remaining space. In Gecko browsers (Firefox, Netscape,...
18
by: day | last post by:
I know I've seen this issue described before, but I can't find it, or the solution now that I need it. I have some css-specified floating divs that contain images or text. The text divs have a...
6
by: Luke Matuszewski | last post by:
As in topic... has anyone used it ? I tried to use it but i guess i failed... here is a code: <html> <head> <title></title> <script type="text/javascript"> function closedWin() {...
4
by: Number 11950 - GPEMC! Replace number with 11950 | last post by:
When www.geoceanis.com is sent to the print preview or alternatively the printer, the second page is displayed or printed by IE, but lost to Gecko (Netscape, Firefox, Moxilla, etc...). NOTE: Both...
0
by: Kenneth McDonald | last post by:
Sorry for crossposting to several lists, but from what I can tell, what I want to do may involve several different areas of expertise. (None of which I have :-( ) I'd like to use Gecko as the UI...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.