+ 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; }
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
+ 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 đđ
+ 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)
+ 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.
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
- 1
What is the difference between , box-shadow and shadow-drop ?