एक लाइन की ऊंचाई को सीएसएस लाइन-ऊंचाई संपत्ति द्वारा परिभाषित किया जा सकता है। यह केवल सकारात्मक मूल्यों को स्वीकार करता है।
सिंटैक्स
CSS लाइन-ऊंचाई प्रॉपर्टी का सिंटैक्स इस प्रकार है -
Selector {
line-height: /*value*/
} उदाहरण
निम्नलिखित उदाहरण CSS लाइन-ऊंचाई गुण को दर्शाते हैं।
<!DOCTYPE html>
<html>
<head>
<style>
div * {
margin: 1.5em;
box-shadow: -13px -10px 10px 1px crimson;
}
#demo {
line-height: 60%;
}
p {
box-shadow: 13px -10px 10px 1px grey;
line-height: 50px;
}
</style>
</head>
<body>
<h2>Demo Heading</h2>
<div>
<p>This is demo text one.</p>
<div>This is demo text two.</div>
<div id="demo">This is demo text three.</div>
</div>
</body>
</html> आउटपुट
यह निम्न आउटपुट देता है -

उदाहरण
<!DOCTYPE html>
<html>
<head>
<style>
div * {
margin: auto;
padding: 3em;
}
p {
height: 100px;
width: 100px;
border: thin solid;
border-radius: 50%;
box-shadow: 0 20px 10px 1px grey;
line-height: 0.6;
}
</style>
</head>
<body>
<h2>What is C#?</h2>
<div>
<p>C# is a strongly-typed language. Every variable and constant has a type, as does every expression that evaluates to a value.</p>
</div>
</body>
</html> आउटपुट
यह निम्न आउटपुट देता है-
