3 replies [Last post]
d0nut
Offline
newbie
Flanders
Last seen: 17 years 5 weeks ago
Flanders
Timezone: GMT+1
Joined: 2003-12-23
Posts: 2
Points: 0

Hi,

I'm new here, but I'm not new to CSS.

I would like to make a text with a background.
That background has to be exactly 2 pxs (one at the top and one at the bottom) larger than the text.

Using Arial at 8 pts, the background is 4 px (so 2 at the top, 2 at the bottom) high.

How can I lower these dimensions ?

Daybreak_0
Offline
Enthusiast
Sydney, Australia
Last seen: 17 years 10 weeks ago
Sydney, Australia
Timezone: GMT+10
Joined: 2003-11-15
Posts: 389
Points: 0

How to specify text background dimensions

You could probably use padding or maybe line-height.

The real problem is we do not know in what context you are talking about - for example is it for all text on one line, or is it for some text in the middle of other text.

Regards
Day

BTW your font should be in PX as well unless this is for printing purposes.

0.75pt = 1px

so 8pt = 11px approx

The only way to learn is to do it yourself

d0nut
Offline
newbie
Flanders
Last seen: 17 years 5 weeks ago
Flanders
Timezone: GMT+1
Joined: 2003-12-23
Posts: 2
Points: 0

How to specify text background dimensions

Thank you very much...

Line height did the trick !

Result:

Now, why should the font be in pixel format ?

Daybreak_0
Offline
Enthusiast
Sydney, Australia
Last seen: 17 years 10 weeks ago
Sydney, Australia
Timezone: GMT+10
Joined: 2003-11-15
Posts: 389
Points: 0

How to specify text background dimensions

d0nut wrote:

Now, why should the font be in pixel format ?

Because it may mean you will get some strange results from different browsers.

PX is for screen viewing
PT is for printing

Regards
Day

The only way to learn is to do it yourself