CSS – Set Height for Paragraph
To set a specific height for Paragraph element using CSS, set height property with required value for the selected paragraph elements in styles(inline/external).
Example
In the following HTML script, we have set height property for paragraphs with different values.
index.html
</>
Copy
<!DOCTYPE html>
<html lang="en">
<head>
<style>
p {
border: 1px solid;
}
#p1 {
height: 30px;
}
#p2 {
height: 40px;
}
#p3 {
height: 50px;
}
</style>
</head>
<body>
<p>Default paragraph.</p>
<p id="p1">Paragraph 1.</p>
<p id="p2">Paragraph 2.</p>
<p id="p3">Paragraph 3.</p>
</body>
</html>
Conclusion
In this CSS Tutorial, we learned how to set height value for paragraph element(s) using CSS.