Margin top, right, bottom, left
If you want to specify a particular margin, you can do it like this:
margin-top: /*some value*/
margin-right: /*some value*/
margin-bottom: /*some value*/
margin-left: /*some-value*/
You can also set an element's margins all at once: you just start from the top margin and go around clockwise (going from top to right to bottom to left). For instance,
margin: 1px 2px 3px 4px;
will set a top margin of 1 pixel, a right margin of 2, a bottom of 3, and a left of 4.
Instructions
Remove our div's
margin: auto;
on the CSS tab. Using whichever method you like best, give it a top margin of 20px, a right margin of 50px, a bottom margin of 10px, and a left margin of 5px.
* {
border: 1px dashed black;
}
div {
height: 50px;
width: 100px;
border: 2px solid black;
border-radius: 5px;
background-color: #308014;
margin-top:20px;
margin-right:50px;
margin-bottom:10px;
margin-left:5px;
}
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<title>Result</title>
</head>
<body>
<div></div>
</body>
</html>
No comments:
Post a Comment