Try being explicit about all the border properties. For example:
border:1px solid black;
See Border shorthand property. Although the other bits are optional some browsers don't set the width or colour to a default you'd expect. In your case I'd bet that it's the width that's zero unless specified.
Answer from Paolo on Stack OverflowW3Schools
w3schools.com › css › css_border.asp
CSS Borders
Note: None of the OTHER CSS border properties (which you will learn more about in the next chapters) will have ANY effect unless the border-style property is set! ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: [email protected] · If you want to report an error, or if you want to make a suggestion, send us an e-mail: [email protected] · HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
W3Schools
w3schools.com › html › html_table_borders.asp
HTML Table Borders
HTML tables can have borders of different styles and shapes.
Videos
07:13
HTML & CSS for Absolute Beginners: Box model - Borders - YouTube
04:27
Learn CSS borders in 4 minutes! 🖼 - YouTube
06:13
🔥 How to Add Borders in HTML Using CSS (Easy & Fast!) - YouTube
Learn CSS borders in 2 minutes
02:12
#119 Border Styling- The Web Dev's Toolkit: HTML, CSS, and ...
Quackit
quackit.com › html › codes › html_borders.cfm
HTML Borders
Using CSS, you can create a border around any HTML element.
HTML Dog
htmldog.com › guides › css › beginner › borders
Borders | HTML Dog
To make a border around an element, all you need is border-style.
GeeksforGeeks
geeksforgeeks.org › html › how-to-add-border-in-html
How To Add Border In HTML? - GeeksforGeeks
July 23, 2025 - Example: In this example, the div styled to have the green solid border on the top side and the purple dotted border on the right side. It will highlighted only the specified sides of the div. ... <!DOCTYPE html> <html> <head> <style> .box { border-top: 5px solid green; border-right: 5px dotted purple; } </style> </head> <body> <h1 style="color: green;">GeeksforGeeks</h1> <div class="box">This div has borders on the top and right sides.</div> </body> </html>
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › CSS › Reference › Properties › border
border - CSS | MDN
border = <line-width> || <line-style> || <color> <line-width> = <length [0,∞]> | thin | medium | thick <line-style> = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset · html · <div>I have a border, an outline, and a box shadow!
Top answer 1 of 8
520
Try being explicit about all the border properties. For example:
border:1px solid black;
See Border shorthand property. Although the other bits are optional some browsers don't set the width or colour to a default you'd expect. In your case I'd bet that it's the width that's zero unless specified.
2 of 8
58
You can use:
border-width:2px;
border-style:solid;
border-color:black;
or as shorthand:
border: 2px solid black
W3Schools
w3schools.com › cssref › pr_border.php
CSS border property
border: border-width border-style border-color|initial|inherit; ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: [email protected] · If you want to report an error, or if you want to make a suggestion, send us an e-mail: [email protected] · HTML ...
Screenstepslive
utah.screenstepslive.com › a › 1865460-basic-borders-and-line-properties
Basic Borders and Line Properties | Advanced HTML Elements | University of Utah
In this page of the borders and lines tutorial, we'll address basic border and line properties: border-width (thickness), border-style, and border-color.
HTML AM
html.am › html-codes › tables › table-border.cfm
Table Border
In HTML, there are two ways of adding a border to your tables. The first is to use the HTML border attribute.
Hyperskill
hyperskill.org › university › frontend › html-border
HTML Border
October 3, 2024 - An HTML border is a feature in web development that allows designers to add visual separation to elements on a webpage. Borders can be applied to various HTML elements like images, tables, div containers, and more. They enhance the structure of a webpage by providing a clear visual outline.
W3Schools
w3schools.com › jsref › prop_style_border.asp
HTML DOM Style border Property
The border property sets or returns up to three separate border properties, in a shorthand form. With this property, you can set/return one or more of the following (in any order): ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: [email protected] · If you want to report an error, or if you want to make a suggestion, send us an e-mail: [email protected] · HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
Codecademy
codecademy.com › docs › css › borders
CSS | Borders | Codecademy
May 27, 2025 - Borders are decorative lines that wrap around the padding and content of HTML elements, appearing between an element’s padding and margin. They provide visual separation and emphasis, helping to define the boundaries of elements on a webpage.
W3Schools
w3schools.com › css › css_border_color.asp
CSS Border Color
The border-color property is used to set the color of the four borders.
CodeWithHarry
codewithharry.com › tutorial › css-borders
Borders | CSS Tutorial | CodeWithHarry
Borders in CSS help define the visual boundaries of HTML elements such as <div>, <p>, <h1>, or even inline elements like <span> With borders, you can enhance the look of your web page by adding outlines, styles, and shapes around elements.
W3Schools
w3schools.com › css › css_border_sides.asp
CSS Border Sides
However, it also works with border-width and border-color. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: [email protected] · If you want to report an error, or if you want to make a suggestion, send us an e-mail: [email protected] · HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial