Border is not drawn around the picture in CSS
Border is not drawn around the picture in CSS
I have a question regarding drawing a border around an image uploaded on the HTML. This is my code in HTML:
.imagec {
display: block;
margin-left: auto;
margin-right: auto;
border: black block 2px;
}
<img class="imagec" src="https://via.placeholder.com/100x100">
I do not know why a border is not drawn around my picture:(
In addition, I cannot draw a border around my HTML page too :(
4 Answers
4
You have to do it as below:
border: 1px solid black;
Insted of
border: black block 2px;
Learn here:https://www.w3schools.com/css/css_border.asp
.imagec{
display: block;
margin-left:auto;
margin-right:auto;
border: 2px solid black;
}
html{
border: 2px solid black;
}
<img class="imagec" src="https://material.angular.io/assets/img/examples/shiba1.jpg">
Try this
<html>
<head>
<style>
.imagec{ display: block; margin-left:auto; margin-right:auto; border: 2px solid black;}
</style>
</head>
<body>
<img class="imagec" src="fish.jpg">
</body>
</html>
I changed your CSS from border: black block 2px; to border: 2px solid black;.
border: black block 2px;
border: 2px solid black;
https://www.w3schools.com/css/css_border.aspborder: black block 2px; solid not block
border: black block 2px;
solid
block
Try this for image:
.imagec{
border:2px solid black;
}
And, For Your Html page:
body{
margin:0px;
border:1px solid red;
}
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
that what you mean???
– לבני מלכה
Jul 2 at 5:02