The image is an element of the type inline
, so it is correct yes to align with text-aling
. Another thing is that float
not to line up, float
is for one element to float next to another. Apart from this the way you set up the layout is not very cool, you used fixed values and is nothing responsive, but I will not get into this matter here...
If you want other alignment techniques you can place the image with display:block and use margin:auto to align it horizontally.
Or else you can change the display
of container
image father to display:flex for example, and place justfy-content:center
to align in the middle. No need to change the image display.
I suggest you read this documentation to better understand these things
Look at the option just changing the image properties without touching the parent container.
*{
margin: 0;
padding: 0;
}
header{
background-color: #35b8b0;
height: 250px;
}
footer{
clear: both;
height: 50px;
background-color: #35b8b0;
text-align: center;
padding-top: 30px;
font-family: monospace;
}
#foto1{
padding-top:500px;
}
#logo{
padding-top: 30px;
width: 100%;
text-align: center;
}
#logo img{
max-width: 100%;
display: block;
margin:0 auto;
}
.container{
width: 1000px;
margin:0 auto;
}
<header>
<div class="container">
<div id="logo">
<img src="https://placecage.com/100/100">
</div>
</div>
</header>
<div id="foto1">
</div>
<footer>Desenvolvido por Arthur Luiz</footer>
The Center tag is obsolete and should not be used! Although it works at the moment can stop working at any time without notice breaking your layout. Check here https://developer.mozilla.org/en-US/docs/Web/HTML/Element/center
– hugocsl