+ 4

What is wrong with my css code? (i'm trying to make a box)

<style type="text/css"> .boxed { border: 1px; width: 700px; height: 1000px; }

28th Oct 2019, 10:15 PM
Myles
Myles - avatar
6 Answers
+ 7
Added a few bits to the code: 1) Removed the type="text/css" (it's only needed when you're linking to external css) 2) added some attributes to the border (black, solid and px width) 3) resized to fit the mobile screen 4) margin is just there so they don't "touch" <html> <head> <title>Boxes</title> <style> .boxed { border: black solid 2px; width: 70px; height: 70px; margin:20px; } </style> </head> <body> <div class="boxed"></div> <div class="boxed"></div> </body> </html> https://code.sololearn.com/Wcjijv3AqcfS/?ref=app
29th Oct 2019, 12:05 AM
HNNX 🐿
HNNX 🐿 - avatar
+ 5
"None of the border properties will work unless the border style is set." E.g .boxed { border:4px solid blue; width:700px; height:1000px; } The border-style property also takes value such as: -Inset -Outset -Groove -Ridge -dashed -dotted -double -hidden -none Hope it's clarifying 👍👍
30th Oct 2019, 5:49 AM
Hayzeed
+ 3
As mentioned, when adding a border via css, make sure to have these in your border property: A pixel measurement (px), "solid" attribute and a color (color name, a color in hex format or rgb format)
29th Oct 2019, 12:12 AM
Xyenia 🩉
Xyenia 🩉 - avatar
+ 3
Avraham Nacher Actually, that's not the reason for the border to be unseen. Even without specifying a color,it will still display a border with default color (Black) The reason for the unseen box is because the border-style property isn't set.
30th Oct 2019, 11:40 AM
Hayzeed
0
You did make a box, but you can't see it because you never gave the border a color or, alternative, give the background-color a color
30th Oct 2019, 9:08 AM
Avraham Nacher
Avraham Nacher - avatar
- 1
What is the difference between , box-shadow and shadow-drop ?
30th Oct 2019, 5:43 PM
Dushyant Kumar Tyagi
Dushyant Kumar Tyagi - avatar