13 replies [Last post]
gmic
Offline
newbie
Last seen: 12 years 45 weeks ago
Timezone: GMT+2
Joined: 2008-08-22
Posts: 4
Points: 0

I tried something along these lines:

a {font-size: 1em; border: 1em; padding: 1em;}

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Now imagine the link text is rather long so that both links can't be shown on one line. Then they are displayed one under the other. To prevent the boxes of both links to overlap I did this:

a {line-height: 5em} because:

1. The letters themselves are 1em high (according to definition).
2. There are 2 times border and 2 times padding between the fonts. According to definition: 4em.

Now both boxes should just touch each other. If I put 5.1 em as line-height then there should be space between the two borders, right? But there isn't! Why? (with 5.2 em there is a little space between them)

David Laakso
David Laakso's picture
Offline
Enthusiast
US
Last seen: 13 years 15 weeks ago
US
Joined: 2008-07-18
Posts: 265
Points: 0

The content is HTML

The content is HTML proprietary, and makes no sense.

gmic
Offline
newbie
Last seen: 12 years 45 weeks ago
Timezone: GMT+2
Joined: 2008-08-22
Posts: 4
Points: 0

David, what do you mean by

David, what do you mean by "content" and what do you mean by "HTML proprietary"?

David Laakso
David Laakso's picture
Offline
Enthusiast
US
Last seen: 13 years 15 weeks ago
US
Joined: 2008-07-18
Posts: 265
Points: 0

src is not an

src is not an attribute, therefore it is HTML proprietary ("garbage").

And this is the content:

<a src="">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</a>
<a src="">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</a>

Do you have a CSS question?

gmic
Offline
newbie
Last seen: 12 years 45 weeks ago
Timezone: GMT+2
Joined: 2008-08-22
Posts: 4
Points: 0

I'm sorry, David. src="" was

I'm sorry, David. src="" was meant to be href="" and why does the content play a role? Just imagine something meaningful would be there instead of the letter a.

Here's the css question:
David, why is there no vertical space between the two links' borders when line-height is 5.1 em if the font-size, borders and paddings only add up to 5 em? (assuming the links are one under the other)

Phreestyle
Phreestyle's picture
Offline
Enthusiast
Australia
Last seen: 5 years 46 weeks ago
Australia
Timezone: GMT+8
Joined: 2007-05-12
Posts: 235
Points: 6

This is my take. An em is

This is my take.
An em is equal to the space a capital M occupies. Ie, 1 em x 1em. However, some letters extend below the line. Ie, the letters y, p, q etc. Therefore, line height is actually greater than 1em to accomodate the tails of these letters

Life's a journey. Enjoy the trip.

David Laakso
David Laakso's picture
Offline
Enthusiast
US
Last seen: 13 years 15 weeks ago
US
Joined: 2008-07-18
Posts: 265
Points: 0

I don't play games. Put it

I don't play games. Put it on a public server with a clickable link to the page/problem in question.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 39 weeks 5 days ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

David Laakso wrote:I don't

David Laakso wrote:

I don't play games. Put it on a public server with a clickable link to the page/problem in question.

The question is quite proper and does indeed deal with css related issues. The markup is intended to be representative and not literal. If you don't like or want to assist in this thread, then don't.

If you lack an understanding of the OP's question, feel free to ask for clarification. Beyond that is not within your purview.

gary
moderator

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

David Laakso
David Laakso's picture
Offline
Enthusiast
US
Last seen: 13 years 15 weeks ago
US
Joined: 2008-07-18
Posts: 265
Points: 0

gary.turner wrote: The

gary.turner wrote:

The question is quite proper and does indeed deal with css related issues. The markup is intended to be representative and not literal.

Then get off my case, and answer the OPs question.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 39 weeks 5 days ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

David Laakso

David Laakso wrote:
gary.turner wrote:

The question is quite proper and does indeed deal with css related issues. The markup is intended to be representative and not literal.

Then get off my case, and answer the OPs question.

After several attempts to encourage less discourtesy and less sarcasm in your responses, and despite your obvious knowledge of the subject, I am blocking your account pending discussion with the other moderators.

If you feel this is arbitrary or undeserved, you may contact the site's administrator at http://csscreator.com/contact

gary.turner
moderator

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 39 weeks 5 days ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

You have chosen to ask about

You have chosen to ask about one area of css's typographical stuff that is poorly understood by the unwashed masses of developers: the inline box model.

Since I have to put myself in that category, I'll give you a simple test case based on your example that I hope will illustrate what's going on.

p {
    margin: 3em;  /*to reveal what would normally be hidden*/
    }
 
 a {
    background-color: white;
    color: red;
    font-size: 1em;
    border: 1em solid red;
    padding: 1em;
    }
 
a#v2 {
    color: blue;
    opacity: .5;
    border-color: blue:
    }
=====================
<p><a href="#">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" id="v2">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</a></p>

You should see that the actual line-height is not affected. The vertical padding and thus the borders do not impinge on lines above and below; they overlap.

See David Baron, a major player at Mozilla and W3C, and Eric Meyer, a NameĀ® in css.

Neither are easy to absorb, but keep trying. Play around with what you see and learn. Come back with the specific questions that arise.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

Stomme poes
Stomme poes's picture
Offline
Elder
Netherlands
Last seen: 10 years 5 weeks ago
Netherlands
Timezone: GMT+2
Joined: 2008-02-04
Posts: 1854
Points: 378

Huh. That's weird. I wish

Huh. That's weird. I wish it would overlap when I'm using line-height to vertically center stuff : )

Now, I don't have IE at the moment cause I'm at home, but with that funny idea it has about line-height=height (well, IE6), do they NOT overlap in IE6? That might explain some things I've seen.

BTW to anyone else with David's confusion about when one would ever meet a case like this, just think of very long links, which have no line breaks and are sometimes very very very long.
http://www.example.com/something/somethingelse/somedates/2008/10/17/someotherstuff?phpstuff/morestuff/strangecodes/298739509834987398734567%

They show up on websites all the time, esp where people can post comments that don't fit the comment-box.

I'm no expert, but I fake one on teh Internets

gmic
Offline
newbie
Last seen: 12 years 45 weeks ago
Timezone: GMT+2
Joined: 2008-08-22
Posts: 4
Points: 0

I didn't want feed the fire

I didn't want feed the fire by stepping into the offtopic lane of David. With this said I want to thank Gary for moderating the thread appropriatly.

I have looked at on of the texts about inline formatting and I have to agree that it is not a very easy to understand matter. For example I didn't know until now that a font has an em-box. So it seems that there are several things I have to learn about first before being able to fully understand the answer to my question. Thanks Gary for showing me the right direction.

Stomme poes
Stomme poes's picture
Offline
Elder
Netherlands
Last seen: 10 years 5 weeks ago
Netherlands
Timezone: GMT+2
Joined: 2008-02-04
Posts: 1854
Points: 378

Yeah I also want to thank

Yeah I also want to thank you Gary for David's Inline Box link-- three boxes??? Geez no wonder stuff doesn't do what I expect it to sometimes. It's bookmarked!

I'm no expert, but I fake one on teh Internets