473,666 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to make equal-width links?

I've been trying to create a simple vertical navigation bar, using (as
recommended) an unordered list (UL) of hyperlinks. I'd like to have a hover
effect, so I have to style the links themselves.

ul.links a:link, ul.links a:visited {
color: #FFFFFF;
background-color: #000000;
}
ul.links a:hover, ul.links a:active {
color: #FF0000;
background-color: #FFFFFF;

My problem is that because the link text length varies, the width of the
background also varies, giving an awful ragged effect on the
right-hand-side. I've seen this done beautifully (but can't now find an
example). Any suggestions?

--
############### #####
## PH, London
############### #####
Jul 21 '05 #1
14 15839
On Mon, 22 Nov 2004 10:29:02 +0000 (UTC), Philip Herlihy
<fo******@herli hy.eu.veil.com> wrote:
I've been trying to create a simple vertical navigation bar, using (as
recommended) an unordered list (UL) of hyperlinks. I'd like to have a
hover
effect, so I have to style the links themselves.

ul.links a:link, ul.links a:visited {
color: #FFFFFF;
background-color: #000000;
}
ul.links a:hover, ul.links a:active {
color: #FF0000;
background-color: #FFFFFF;

My problem is that because the link text length varies, the width of the
background also varies, giving an awful ragged effect on the
right-hand-side. I've seen this done beautifully (but can't now find an
example). Any suggestions?


How about setting a width on <li> and setting the width for <a> and all
the pseudoclasses as necessary on 100%?
--
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>
Jul 21 '05 #2
Philip Herlihy wrote:

<snip>
ul.links a:link, ul.links a:visited {
color: #FFFFFF;
background-color: #000000;
}
<snip>
My problem is that because the link text length varies, the width of the
background also varies, giving an awful ragged effect on the
right-hand-side. I've seen this done beautifully (but can't now find an
example). Any suggestions?


ul.links {
width: 10em;
}

--
Philip Ronan
ph***********@v irgin.net
(Please remove the "z"s if replying by email)
Jul 21 '05 #3
Els
Philip Herlihy wrote:
I've been trying to create a simple vertical navigation
bar, using (as recommended) an unordered list (UL) of
hyperlinks. I'd like to have a hover effect, so I have to
style the links themselves.

ul.links a:link, ul.links a:visited {
color: #FFFFFF;
background-color: #000000;
}
ul.links a:hover, ul.links a:active {
color: #FF0000;
background-color: #FFFFFF;

My problem is that because the link text length varies, the
width of the background also varies, giving an awful ragged
effect on the right-hand-side. I've seen this done
beautifully (but can't now find an example).
See link in sig ;-)
Any suggestions?


Set a width (in ems) to the <li> element, and set the <a>
element to display:block; width:100%.

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Deep Purple - Burn
Jul 21 '05 #4
Els wrote:
Philip Herlihy wrote:
I've been trying to create a simple vertical navigation bar, using
(as recommended) an unordered list (UL) of hyperlinks. I'd like to
have a hover effect, so I have to style the links themselves.

My problem is that because the link text length varies, the width
of the background also varies, giving an awful ragged effect on the
right-hand-side.


Set a width (in ems) to the <li> element, and set the <a> element to
display:block; width:100%.


width: 100% only for broken MSIE/Win. Use width: auto for Firefox and Opera.

--
Brian (remove "invalid" to email me)
Jul 21 '05 #5
"Philip Ronan" <ph***********@ virgin.net> wrote in message
news:BDC77380.2 5DF0%ph******** ***@virgin.net. ..
Philip Herlihy wrote:

<snip>
ul.links a:link, ul.links a:visited {
color: #FFFFFF;
background-color: #000000;
}


<snip>
My problem is that because the link text length varies, the width of the
background also varies, giving an awful ragged effect on the
right-hand-side. I've seen this done beautifully (but can't now find an
example). Any suggestions?


ul.links {
width: 10em;
}

Thanks for the reply, Philip, but that doesn't seem to do the trick...

--
############### #####
## PH, London
############### #####
Jul 21 '05 #6
"Barbara de Zoete" <b_********@hot mail.com> wrote in message
news:opshu30yhv x5vgts@zoete_b. ..
On Mon, 22 Nov 2004 10:29:02 +0000 (UTC), Philip Herlihy
<fo******@herli hy.eu.veil.com> wrote:
I've been trying to create a simple vertical navigation bar, using (as
recommended) an unordered list (UL) of hyperlinks. I'd like to have a
hover
effect, so I have to style the links themselves.

ul.links a:link, ul.links a:visited {
color: #FFFFFF;
background-color: #000000;
}
ul.links a:hover, ul.links a:active {
color: #FF0000;
background-color: #FFFFFF;

My problem is that because the link text length varies, the width of the
background also varies, giving an awful ragged effect on the
right-hand-side. I've seen this done beautifully (but can't now find an
example). Any suggestions?


How about setting a width on <li> and setting the width for <a> and all
the pseudoclasses as necessary on 100%?


Almost! Need to set display: block; on the <a> (as suggested by Els)

Thanks!

--
############### #####
## PH, London
############### #####
Jul 21 '05 #7
"Els" <el*********@ti scali.nl> wrote in message
news:Xn******** *********@130.1 33.1.4...
Philip Herlihy wrote:
I've been trying to create a simple vertical navigation
bar, using (as recommended) an unordered list (UL) of
hyperlinks. I'd like to have a hover effect, so I have to
style the links themselves.

ul.links a:link, ul.links a:visited {
color: #FFFFFF;
background-color: #000000;
}
ul.links a:hover, ul.links a:active {
color: #FF0000;
background-color: #FFFFFF;

My problem is that because the link text length varies, the
width of the background also varies, giving an awful ragged
effect on the right-hand-side. I've seen this done
beautifully (but can't now find an example).


See link in sig ;-)
Any suggestions?


Set a width (in ems) to the <li> element, and set the <a>
element to display:block; width:100%.

--
Els http://locusmeus.com/

....

Bang on! Thanks!

Love the site, by the way - the "frosted" look is great.

--
############### #####
## PH, London
############### #####
Jul 21 '05 #8
On Mon, 22 Nov 2004 20:54:49 +0000 (UTC), Philip Herlihy
<fo******@herli hy.eu.veil.com> wrote:
"Barbara de Zoete" <b_********@hot mail.com> wrote in message
news:opshu30yhv x5vgts@zoete_b. ..
On Mon, 22 Nov 2004 10:29:02 +0000 (UTC), Philip Herlihy
<fo******@herli hy.eu.veil.com> wrote:
I've been trying to create a simple vertical navigation bar, using (as
recommended) an unordered list (UL) of hyperlinks. I'd like to have a
hover
effect, so I have to style the links themselves.

ul.links a:link, ul.links a:visited {
color: #FFFFFF;
background-color: #000000;
}
ul.links a:hover, ul.links a:active {
color: #FF0000;
background-color: #FFFFFF;

My problem is that because the link text length varies, the width of
the background also varies, giving an awful ragged effect on the
right-hand-side. I've seen this done beautifully (but can't now find
an example). Any suggestions?

How about setting a width on <li> and setting the width for <a> and all
the pseudoclasses as necessary on 100%?


Almost! Need to set display: block; on the <a> (as suggested by Els)


Yeah, I spotted that ommission just after I posted this. But then saw that
Els had the correct solution posted already. So didn't bother to correct
mine.
Thanks!

Your welcome
--
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>
Jul 21 '05 #9
"Brian" <us*****@juliet remblay.com.inv alid> wrote in message
news:9s******** *************@b gtnsc04-news.ops.worldn et.att.net...
Els wrote:
Philip Herlihy wrote:
I've been trying to create a simple vertical navigation bar, using
(as recommended) an unordered list (UL) of hyperlinks. I'd like to
have a hover effect, so I have to style the links themselves.

My problem is that because the link text length varies, the width
of the background also varies, giving an awful ragged effect on the
right-hand-side.


Set a width (in ems) to the <li> element, and set the <a> element to
display:block; width:100%.


width: 100% only for broken MSIE/Win. Use width: auto for Firefox and
Opera.

....

Thanks! Seems to work ok in Opera with 100%, but I'm still exploring.

--
############### #####
## PH, London
############### #####
Jul 21 '05 #10

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

Similar topics

7
1861
by: Ben | last post by:
Hi all, I'm not yet good at thinking the right way in c++ so although I could solve this problem, I'm not sure if they way I'm thinking of is the best way to do it. I need a data type or class or something that can hold either an int, or a float, knows which one it is holding, and will allow me to do comparisons with instances of it without the code which asks for the comparison having to know which one it is. So maybe I could do it...
0
436
by: mike | last post by:
regards: Does the following programming architecture make sense? http://www.wretch.cc/album/show.php?i=otp&b=1&f=1111993473&p=2 My program logic is following: --------------------------------------------------------------------------- My machine's ip is xxx.xxx.xxx.xxx and open port 85 Mobile client access my machine by http://xxx.xxx.xxx.xxx:85
7
4370
by: ale.of.ginger | last post by:
Another question: I am writing a sudoku solving program. The 'solving' part of is just multiple iterations. It will take random numbers and keep switching it all around until a set of logic statements has been met (ie; all numbers in a row are not equal to each other) ... that's where my question comes in. Cellboard = my list for storing each row/column's data. Rather than writing
11
5169
by: namenotgivenhere | last post by:
My design goal is to make the white space above and below <p> and <ul> equal to the height of my font. The first step to achieving this I believe is to have an equal amount of white space above or below <p> and <ul>. Can someone suggest a method using css to accomplish this? I have succeeded in doing this in IE6 but I'd also like to know if there's a method to achive this goal that will have a similar visual look in other modern browsers....
17
4519
by: Mark A | last post by:
DB2 8.2 for Linux, FP 10 (also performs the same on DB2 8.2 for Windoes, FP 11). Using the SAMPLE database, tables EMP and EMLOYEE. In the followng stored procedure, 2 NULL columns (COMM) are selected into 2 different SP variables and compared for equal. They are both NULL, but do not compare as equal. When the Not NULL columns (SALARY) are compared, they do compare as equal.
5
1112
by: Bruce | last post by:
I am a C++ programmer so sorry for the simple VB question. If I have two instances of the same type of object, how do I make the value of one equal to the other? If I do Dim ObjA as new MyObject Dim ObjB as new MyObject
12
1889
by: =?Utf-8?B?S2plbGw=?= | last post by:
Hello I've taken a four days training in C#, very good training, experienced teacher and all that, very positive. Went home spent a week making my first application, slightly more than the usual "Hello world". Took it with me to my best customer, and beleive it or not....It will not work !!!!
12
2089
by: Slaunger | last post by:
Hi, I am new here and relatively new to Python, so be gentle: Is there a recommended generic implementation of __repr__ for objects equal by value to assure that eval(repr(x)) == x independet of which module the call is made from? Example:
3
1623
by: fuchsia555 | last post by:
how to make $ = any other symbol in javascript language to make this javascript code to read this symbol as $ for example how to make javascript read ( # ) as ( $ ) because i want to put #TEXT# in php code but i want certain javascript program read this as $TEXT$ ,,,, why ? because if i put $TEXT$ in php it read it as a variable and doesn't generated in html source so javascript program will not work
3
2664
mseo
by: mseo | last post by:
hi, I have a report connected to a form where I can print the invoices between the two dates in the form but I have the problem: when the checkbox = true refers to Canceled invoice but the values in this record still as it is, and I want to make the values equal zero if the checkbox = true, I tried hardly to make them equal zeros but the record disappeared from the report I want to include the record within the report equal zero even it has...
0
8348
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8863
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
8779
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...
1
8549
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
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...
1
6187
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4186
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...
2
1761
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.