How to create border to the page? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to create border to the page?

Using html code

2nd May 2020, 4:27 AM
Katkar Shekhar
Katkar Shekhar - avatar
13 Answers
+ 7
Katkar Shekhar Tanaji Delete everything in your css code and add these : body { border: 2px solid red; padding: 5px; } It will add a red border to the body. You can change the color for different border color.
2nd May 2020, 5:34 AM
Arb Rahim Badsa
Arb Rahim Badsa - avatar
+ 7
Katkar Shekhar Tanaji Your code is correct, just remove that <style> from style section. You already gave border to the body{} so it will give border to whole page.
2nd May 2020, 5:03 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
Katkar Shekhar Tanaji remove the <style></style> in css code playground and make P in lowercase the code should be p{ border-style: solid; }
2nd May 2020, 4:39 AM
tres
+ 2
...@ will be possible Use Add to css .... p.one {   border-style: solid;   border-width: 5px 20px; /* 5px top and bottom, 20px on the sides */ } Or p.two {   border-style: solid;   border-width: 20px 5px; /* 20px top and bottom, 5px on the sides */ } Or p.three {   border-style: solid;   border-width: 25px 10px 4px 35px; /* 25px top, 10px right, 4px bottom and 35px left */ }
2nd May 2020, 8:21 PM
Bonface Muriithi
+ 1
you can create border using css. To make border around element you can use border-style, border-width to sets the width of the border and border-color to sets color. Just search border properties of css.
2nd May 2020, 4:31 AM
tres
+ 1
https://code.sololearn.com/WPyG3RWVP5Jm/?ref=app Check my code but border doesnt work.
2nd May 2020, 4:35 AM
Katkar Shekhar
Katkar Shekhar - avatar
+ 1
Thanks bro.. 😊😊
2nd May 2020, 5:37 AM
Katkar Shekhar
Katkar Shekhar - avatar
+ 1
Katkar Shekhar Tanaji However, you can change that '2px' to any value like '3px' or '5px' for a thick border.
2nd May 2020, 5:40 AM
Arb Rahim Badsa
Arb Rahim Badsa - avatar
+ 1
border:1px solid palegreen; even can be used = border-left, border-right, border-bottom, border-top.
2nd May 2020, 2:08 PM
Edwin Boada
Edwin Boada - avatar
+ 1
You can do it without deleting everything in your css just to ckeck if the body tag have any css wrote already and if there is any *{ } css code in your css file *{ } this refers to add to complete css code . You can the add your body code body{ border:2px solid red; } Or add inline code in html if it suits your arrangements <body style=" border:2px solid red";> Like this Katkar Shekhar Tanaji
3rd May 2020, 10:22 AM
Abhijeet Thorat
Abhijeet Thorat - avatar
0
Lean - No it gives border to only paragraphs i want border for whole page. Will it happens..... 🙄
2nd May 2020, 4:55 AM
Katkar Shekhar
Katkar Shekhar - avatar
0
Rick Grimes i have did as u said but this wont work plss cheak it again...
2nd May 2020, 5:12 AM
Katkar Shekhar
Katkar Shekhar - avatar