XHTMLforum

XHTMLforum (http://xhtmlforum.de/index.php)
-   CSS (http://xhtmlforum.de/forumdisplay.php?f=73)
-   -   Zeilenabstand bei font-Angabe wieder weg (http://xhtmlforum.de/showthread.php?t=50405)

nick 15.02.2008 17:10

Zeilenabstand bei font-Angabe wieder weg
 
Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="robots" content="no-index, no-follow, no-cache" />
<style type="text/css">
*
{
        font: 11px verdana, arial, "courier new";
        line-height: 1.25em;
}

body
{
        font: 11px verdana, arial, "courier new";
}

p
{

}
</style>
<title>ohgott</title>
</head>
<body>

Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text

<p>Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text, Text</p>

</body>
</html>

http://scriptjunkies.bplaced.net/ima...lenabstand.png

Über den Universal-Selector verpasse ich Text in jedem Element ihre Zeilenhöhe auf 125%. Weise ich body, wie im geposteten markup, die Schriftart neu zu, ist er wieder weg. Sobald ich p auch eine font-Angabe verpasse, sind die Zeilenhöhe seiner Texte auch zurückgesetzt.

Ist zwar klar, dass der Inizialisierwert von line-height nicht Inherit ist, das Ganze geht ja aber über den universal-Selector. Außerdem frage ich mich ja, wieso der Wert bei Zuweisung von font wieder zurückgesetzt ist!?

fricca 15.02.2008 17:19

Die zusammenfassende Eigenschaft setzt alle nicht-angegebenen Werte auf den Initialwert.
Zitat:

Zitat von http://www.w3.org/TR/CSS21/fonts.html#font-shorthand
All font-related properties are first reset to their initial values, including those listed in the preceding paragraph. Then, those properties that are given explicit values in the 'font' shorthand are set to those values.


nick 15.02.2008 18:05

Au ***!
ine-height ist ein Faktor in diesem short hand property!?
Das erklärt's dann natürlich...
Code:

font: 11px 1.25em verdana, arial, "courier new";
Das intepretiert mein ff jetzt aber nicht. Ist doch nach dem passenden Muster?
Code:

Value:          [ [ <'font-style'> || <'font-variant'> || <'font-weight'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar | inherit

fricca 15.02.2008 18:12

Code:

font: 11px/1.25em verdana, arial, "courier new";
Zitat:

Value: [ [ <'font-style'> || <'font-variant'> || <'font-weight'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar | inherit

hubspe 15.02.2008 20:18

Hi,

soweit ich weiß soll man doch bei line-height (glaub wg. evtl. Vererbungsproblemen) immer die Maßeinheit weglassen, also nicht line-height:1.25em sondern line-height:1.25

Gruß
Klaus

heiko_rs 15.02.2008 23:02

Genau, denn dann wirkt's als Faktor, was einfach perfekt ist.

nick 16.02.2008 15:34

Was soll das / denn jetzt? Heißt das, dass ich in dem short hand nur Schriftgröße oder Zeilenhöhe eingeben kann, nur eins von beiden?

fricca 16.02.2008 15:39

Das "/" ist die korrekte Syntax.
Was liest du eigentlich um CSS zu lernen? In jedem Tutorial und auch in der Spezifikation findest du Beispiele dafür!


Alle Zeitangaben in WEZ +2. Es ist jetzt 13:58 Uhr.

Powered by vBulletin® Version 3.8.11 (Deutsch)
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

© Dirk H. 2003 - 2023