Tell us what’s happening:
I saw the syntax from w3schools “https://www.w3schools.com/howto/howto_css_shapes.asp”.
I know I must have done something silly, please help.
Your code so far
<!DOCTYPE html>
<head>
<title>csstransi</title>
<link rel="stylesheet" type="text/css" href="square.css">
</head>
<body>
<h1>This is a square</h1>
<div class="square">
</div>
</body>
</html>
...CSS
.square{
width:50px;
height:50px;
border-radius:50%;
color:black;
}
You have to put css in <style></style> tags.
There is a circle there, but you can not see it, because you did not change the background-color property of the square class. If you want a square, you need to remove the border-radius: 50%;
2 Likes
border-radius: 50%
will turn a square into a circle.
1 Like
Ah, okay. I seem to have missed that detail.
Thanks.
I thought the color property would change it.
How can I get the square to center
html
<!DOCTYPE html>
<head>
<title>csstransi</title>
<link rel="stylesheet" type="text/css" href="shapes.css">
</head>
<body>
<h1>Shapes</h1>
<div class="body">
</div>
</body>
</html>
css
.body{
width: 70px;
height: 100px;
background-color: gray;
justify-content: center;
}
horizontally
but i also like to know how to center vertically
how can i position the shapes at various places in the screen