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 <li> 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> 6 3214
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 -
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.
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
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 -
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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>
|
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...
|
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,...
|
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...
|
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() {...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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,...
|
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...
|
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...
| |