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 Overflow
🌐
W3Schools
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.
🌐
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!
🌐
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 ...
Find elsewhere
🌐
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.
🌐
HubSpot
blog.hubspot.com › website › css-border
How to Create and Style Borders in CSS
February 23, 2023 - The border-style property can have between one and four values. If only one value is defined, then it applies to all sides of the element. If two values are defined, then the first value represents the top and bottom borders and the second represents the right and left borders.
🌐
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
🌐
SheCodes
shecodes.io › athena › 12475-how-to-create-a-border-in-html-and-css
[HTML] - How to create a border in HTML and CSS - SheCodes | SheCodes
Learn how to use the border property in CSS to create a border around an HTML element with this step-by-step guide.
🌐
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.
🌐
Computer Hope
computerhope.com › issues › ch001392.htm
How to Create a Colored Border Around Text with HTML and CSS
Using borders, you can add a box around text, and set or change the border to nearly any color. A border in your HTML (HyperText Markup Language) page helps bring attention to a section of text or surround any other HTML elements.
🌐
GeeksforGeeks
geeksforgeeks.org › css › css-borders
CSS Borders - GeeksforGeeks
May 21, 2018 - CSS borders define the outline around an HTML element, providing visual separation and emphasis within a webpage layout.
🌐
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