Q:

How to Create a Vertical Line in HTML

0

How to Create a Vertical Line in HTML

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Use the CSS border Property

You can use the CSS border property on a <span> element in combination with the other CSS property like display and height property to make vertical lines in HTML.

The following example will create a vertical separator line between two images. You can further increase the height of the line by simply increasing the value of the height property.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Make a Vertical Line in HTML</title>
<style>
    .vertical-line{
        display: inline-block;
        border-left: 1px solid #ccc;
        margin: 0 10px;
        height: 125px;
    }
</style>
</head>
<body>
    <img src="/examples/images/club.jpg" alt="Club Card">
    <span class="vertical-line"></span>
    <img src="/examples/images/spade.jpg" alt="Spade Card">
</body>
</html>

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

HTML / CSS Frequently Asked Questions

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
How to Change the Cursor into a Hand Pointer on Ho... >>
<< How to create an HTML button that acts like a link...