473,471 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

line-height in wrapped text

I'm having difficulty creating a menu on the left of a web page where each
link appears to have a 4px padding around the edge but I'm trying to do this
as a pure unordered list. The "current web page" is just a line item without
a hyperlink and the stylesheet takes care of everything.

I thought I had everything fine and dandy after doing this: #menu li {
line-height: 22px; } as seen in this example:
http://marc.fearby.com/line-height.html but as soon as the text wraps to a
second line, the unsightly effect is a large gap between the two lines.

I then thought about using padding settings here and there but this just
didn't work. I tried #menu li a { padding-bottom: 4px; } which is fine for
list items that contain hyperlinks, but not for ordinary list items. As soon
as I try doing this for ordinary list items, they look fine at the expense
of those with hyperlinks. Example with inline style here:
http://marc.fearby.com/padding.html

I can't fix one up without ruining the other and I can't employ negative
margins which I used to get around this same problem for the margin-left (or
at least I haven't got it to work yet, unfortunately).

Is such a thing possible with just bare-bones lists and hyperlinks or am I
going to have to use divs for east list item and fine some way to make it
work with extra tags? I sure hope not...
Jul 20 '05 #1
11 4536
Els
Frostillicus wrote:
I'm having difficulty creating a menu on the left of a web
page where each link appears to have a 4px padding around
the edge but I'm trying to do this as a pure unordered
list. The "current web page" is just a line item without
a hyperlink and the stylesheet takes care of everything.

I thought I had everything fine and dandy after doing this:
#menu li { line-height: 22px; } as seen in this example:
http://marc.fearby.com/line-height.html but as soon as the
text wraps to a second line, the unsightly effect is a
large gap between the two lines.

I then thought about using padding settings here and there
but this just didn't work. I tried #menu li a {
padding-bottom: 4px; } which is fine for list items that
contain hyperlinks, but not for ordinary list items. As
soon as I try doing this for ordinary list items, they look
fine at the expense of those with hyperlinks. Example with
inline style here: http://marc.fearby.com/padding.html

I can't fix one up without ruining the other and I can't
employ negative margins which I used to get around this
same problem for the margin-left (or at least I haven't got
it to work yet, unfortunately).

Is such a thing possible with just bare-bones lists and
hyperlinks or am I going to have to use divs for east list
item and fine some way to make it work with extra tags? I
sure hope not...


Only one extra tag and one extra styleblock to go with the tag
:-)

http://locusmeus.com/temp/frostillicus.html

Is that what you were looking for? I sort of got lost in all
the paddings and pixels in your story...

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 20 '05 #2
Els
Els wrote:
Frostillicus wrote:
I'm having difficulty creating a menu on the left of a web
page where each link appears to have a 4px padding around
the edge but I'm trying to do this as a pure unordered
list. The "current web page" is just a line item without
a hyperlink and the stylesheet takes care of everything. [...] Is such a thing possible with just bare-bones lists and
hyperlinks or am I going to have to use divs for east list
item and fine some way to make it work with extra tags? I
sure hope not...


Only one extra tag and one extra styleblock to go with the
tag
:-)

http://locusmeus.com/temp/frostillicus.html

Is that what you were looking for? I sort of got lost in
all the paddings and pixels in your story...


Oh, and btw, get rid of pt for font-size, use percentages, so IE
users can resize them too.

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 20 '05 #3
On Thu, 19 Aug 2004 22:46:45 +1000, "Frostillicus"
<fr****@nilspamos.iinet.net.au> wrote:
I'm having difficulty creating a menu on the left of a web page where each
link appears to have a 4px padding around the edge but I'm trying to do this
as a pure unordered list. The "current web page" is just a line item without
a hyperlink and the stylesheet takes care of everything.

I thought I had everything fine and dandy after doing this: #menu li {
line-height: 22px; } as seen in this example:
http://marc.fearby.com/line-height.html but as soon as the text wraps to a
second line, the unsightly effect is a large gap between the two lines. I then thought about using padding settings here and there but this just
didn't work. I tried #menu li a { padding-bottom: 4px; } which is fine for
list items that contain hyperlinks, but not for ordinary list items. As soon
as I try doing this for ordinary list items, they look fine at the expense
of those with hyperlinks. Example with inline style here:
http://marc.fearby.com/padding.html


#menu li { padding-bottom: 4px; } would work fine, except that you
seem to have confused things by specifying a background-color in "#menu
li a" instead of "#menu li". If you want a different background colour
in the cell corresponding to the current page you'll need a class on
that cell, but I suggest that a contrasting foreground colour would be
as good, if not better.

Actually it would probably look better with (a) padding all the way
around, and (b) padding in ems, so it is proportional to the text size.
Soemthing like #menu li { padding: 0.3em; }

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 20 '05 #4
I guess I got carried away in trying to keep the HTML as bare-bones as
possible, and when I view the page without the stylesheet, I like having the
current page appear as just an ordinary list-item and no hyperlink, but as
els has suggested, I guess I just gotta put a class in there and use a
hyperlink to achieve what I want.

"Stephen Poley" <sb******************@xs4all.nl> wrote in message
news:ft********************************@4ax.com...
#menu li { padding-bottom: 4px; } would work fine, except that you
seem to have confused things by specifying a background-color in "#menu
li a" instead of "#menu li". If you want a different background colour
in the cell corresponding to the current page you'll need a class on
that cell, but I suggest that a contrasting foreground colour would be
as good, if not better.

Actually it would probably look better with (a) padding all the way
around, and (b) padding in ems, so it is proportional to the text size.
Soemthing like #menu li { padding: 0.3em; }

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/

Jul 20 '05 #5
Els
Frostillicus wrote:
I guess I got carried away in trying to keep the HTML as
bare-bones as possible, and when I view the page without
the stylesheet, I like having the current page appear as
just an ordinary list-item and no hyperlink, but as els has
suggested, I guess I just gotta put a class in there and
use a hyperlink to achieve what I want.


No, not a hyperlink, just an <a> element.

And you'll have to check my code to see how exactly it works,
but disabling the styles for my pages, leaves the current menu
item not underlined, as it's not a link.

It just helps to code all menu items the same way.
I did it myself with the menu on my own site, couldn't find
another method to get them divided all evenly.

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Mr. Big - Green-tinted Sixties Mind
Jul 20 '05 #6
Thanks, Els. The only thing I had to do was specify a padding-top so that IE
didn't render the page with the text all scrunched up at the top. It looked
perfectly OK in Firefox, but, as usual, we have to cater for IE sadly.

Thanks for your help!

"Els" <el*********@tiscali.nl> wrote in message
news:Xn*****************@130.133.1.4...
Els wrote:
Oh, and btw, get rid of pt for font-size, use percentages, so IE
users can resize them too.

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

Jul 20 '05 #7
Els wrote:
Frostillicus wrote:
I'm having difficulty creating a menu on the left of a web
[snip]

25 lines of quoted material (not including blank lines)...
Only one extra tag and one extra styleblock to go with the tag

[snip]

5 lines of new material, one with only an emoticon. Not a very good s/n
radio, Els.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #8
Els
Brian wrote:
Not a very good s/n radio, Els.


Not a very good spelling, Brian ;-)

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Skid Row - 18 and Life (Live in Knoxville 91)
Jul 20 '05 #9
Els wrote:
Brian wrote:
Not a very good s/n radio, Els.


Not a very good spelling, Brian ;-)


Touché.[1] It's the field I used to work in; I inquired about a radio
job this week, so it's fresh on my mind. Plus, s/n ratio is quite
related to radio equipment.

[1] You're still not off the hook for excessive quoting! :-p

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #10
Els
Brian wrote:
Els wrote:
Brian wrote:
Not a very good s/n radio, Els.
Not a very good spelling, Brian ;-)


Touché.[1] It's the field I used to work in; I inquired
about a radio job this week, so it's fresh on my mind.


Are you getting the job?
Plus, s/n ratio is quite related to radio equipment.
Weak. Very weak argument. <g>
[1] You're still not off the hook for excessive quoting!
:-p


That's okay ;-)

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 20 '05 #11
Els wrote:
Brian wrote:
I inquired about a radio job this week


Are you getting the job?


Extremely unlikely.
Plus, s/n ratio is quite related to radio equipment.


Weak. Very weak argument. <g>


Aww! And I was rather pleased with that connection!

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #12

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

Similar topics

19
by: les_ander | last post by:
Hi, suppose I am reading lines from a file or stdin. I want to just "peek" in to the next line, and if it starts with a special character I want to break out of a for loop, other wise I want to...
6
by: mary | last post by:
When we use string line; while (getline(in,line)) { out.write(line.c_str(),line.size()); out.put('\n'); } in.close();
8
by: Peter A. Schott | last post by:
Per subject - I realize I can copy/paste a line at a time into an interactive session when I'm trying to debug, but was wondering if there is any tool out there that allows me to copy sections of...
8
by: Frost | last post by:
Hi All, I am a newbie i have written a c program on unix for line by line comparison for two files now could some one help on how i could do word by word comparison in case both lines have the...
3
by: Double Echo | last post by:
Hi all, I'm using PHP 4.4.2, and use PHP on both the command-line and the web. I am running PHP on SuSE 10 Linux , in a VMware 5.5 workstation, using Apache 2.0.55 , on my Dell laptop. ...
14
by: WStoreyII | last post by:
the following code is supposed to read a whole line upto a new line char from a file. however it does not work. it is producing weird results. please help. I had error checking in there for...
3
by: amitp | last post by:
Can anyone tell me how can i break a line in MS WORD doc thru VB 6.0 application? I'm replacing the field values with the data from the databse in MS WORD doc. One of my field value is ( "Jan tst....
0
by: 7stud | last post by:
Hi, 1) Does this make any sense: """ Thus, the loop: for line in f: iterates on each line of the file. Due to buffering issues,
11
by: xdevel | last post by:
Hi, I don't understand option. if I write: #line 100 "file" I change file numeration to start to line 100 but what "file" ? any example?
0
by: iheartvba | last post by:
Hi, I have got a document where there are headings which are always the same, but their sub categories are always different. The Structure is as follows: Line 1: Heading 1 Line 2: Sub Heading...
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
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...
1
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,...
1
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...
0
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...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.