0
How to create a border
Hi guys I'm trying to create a border using the style attributes in the div tag but it's not working <div style="border:5px" border-color :"solid blue"></div>
7 Antworten
+ 2
The border style you've written is incorrect. Here is the correct syntax to create a blue solid border with a width of 5px:
<div style="border: 5px solid blue;"></div>
+ 6
style='border: solid black 5px;'
+ 2
For more context, you are on the right track. You have a few syntax issues.
E.g.
Incorrect
<div style="border:5px" border-color :"solid blue"></div>
Correct
<div style="border-width: 5px; border-style: solid; border-color: blue;"></div>
Your example explores individual border properties. border-width, border-style, and border-color.
Once you understand the individual properties and syntax. You may use the shorthand version.
E.g.
<div style="border: 5px solid blue"></div>
0
Please give your opinions on what you think I can do
0
Thanks everyone
Finally got the right result
0
Isn‘t „border-width: 5px“ what would also make your code work? Of course having only one line is better just out of curiosity
0
The issue with the code is that the border-color property is not being recognized as it is written incorrectly. The correct syntax for the border property is to specify the width, style, and color in a single line, separated by spaces.
Here's an example of how you can create a blue solid border with a width of 5px:
<div style="border: 5px solid blue"></div>