Whenever I try to create an element with a div, I notice there is always some space between the content and the border (blue line). On the other hand, using span causes the content to break, appearing outside the borders.
Here is my CSS code:
#main1 {
margin-left: 40%;
background-color: lightgrey;
width: 20%;
border: 5px;
padding: 5px;
border-style: solid;
border-color: grey;
border-width: 2px;
text-align: left;
}
body {
text-align: center;
background-color: yellow;
font-family: "Arial";
}
Below is my HTML:
<!DOCTYPE html>
<html>
<head>
<title>BMI</title>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<div id="main1">
<h3>BMI calculator</h3>
<form action="results.php" method=""post"">
<input type="radio" name="gender" value="man">Man<br>
<input type="radio" name="gender" value="vrouw">Vrouw<br><br>
Lengte:<br>
<input type="text" name="lengte"><br>
Gewicht:<br>
<input type="text" name="gewicht"><br><hr>
<button action="submit">Submit</button>
</form>
</div>
</body>
</html>
Does anyone know of a solution to this issue? As someone new to web design, I haven't been able to find any information online... Thanks!