I know that to align a text is used text-align: center
.
But to align a photo that has a link in it? I did tests here with commands that I do not know, like align-content
, to see if it worked, but it did not. I have two questions.
1 ° How do you align a photo that has a link in the center of the page?
2nd Is this line right? Then put the alignment code inside it.
.imagem {}
Edit: I tried to put the margin:auto
, in div
of the image, but it did not work, n made any changes.
Html:
<!DOCTYPE html>
<html>
<head>
<title>sas</title>
<link rel="stylesheet" type="text/css" href="sasi.css">
</head>
<body>
<div class="imagem">
<a href="#"><img src="https://lh3.googleusercontent.com/l6JAkhvfxbP61_FWN92j4ulDMXJNH3HT1DR6xrE7MtwW-2AxpZl_WLnBzTpWhCuYkbHihgBQ=w640-h400-e365"width="50%" height="50%"></a>
</div>
</body>
</html>
Css:
.imagem {
margin:auto; //aplica margem aos quatro lados
width:200px;
}