CSS – Set Border for Paragraph
To set a specific border for Paragraph element using CSS, set border property with required value in styles(inline/external) for the selected Paragraph element(s).
Example
In the following HTML script, we have set border for paragraphs with different values.
index.html
</>
Copy
<!DOCTYPE html>
<html lang="en">
<head>
<style>
#p1 {
border: 1px solid black;
}
#p2 {
border: 1px dotted red;
}
#p3 {
border: 5px solid blue;
}
</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 border for paragraph element(s) using CSS.