How to create a border | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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>

5th Feb 2023, 5:21 PM
jinadu adebimpe
jinadu adebimpe - avatar
7 Answers
+ 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>
5th Feb 2023, 5:59 PM
ArsenicolupinIII
+ 6
style='border: solid black 5px;'
5th Feb 2023, 5:50 PM
Lisa
Lisa - avatar
+ 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>
6th Feb 2023, 11:16 PM
Chris Coder
Chris Coder - avatar
0
Please give your opinions on what you think I can do
5th Feb 2023, 5:24 PM
jinadu adebimpe
jinadu adebimpe - avatar
0
Thanks everyone Finally got the right result
5th Feb 2023, 6:16 PM
jinadu adebimpe
jinadu adebimpe - avatar
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
5th Feb 2023, 9:55 PM
Rico Rambke
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>
7th Feb 2023, 4:13 AM
Manhar Hadiyal
Manhar Hadiyal - avatar