Can anyone tell my why my centre tag is not working? The css and html both are contained in the same code. First I tried to resolve the issue by using position as absolute, but I want a responsive webpage and want to keep the div (photo) in the centre of the page.
#photo-left {
float: left;
height: 180px;
width: 140px;
border: red dashed 2px;
}
#photo-right {
float: left;
height: 180px;
width: 140px;
border: red dashed 2px;
}
#photo {
/*position: relative;
top:150px;
left: 35%;*/
height: 180px;
margin: auto;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome</title>
</head>
<body>
<header style="position: relative;top: 100px;">
<nav>
<ul>
<li><a href="index.html">Home</a></li>
</ul>
</nav>
</header>
<center>
<div id="photo">
<div id="photo-left"></div>
<div id="photo-right"></div>
</div>
</center>
</body>
</html>