I have a picture and text, and I want to align both of them to center (both horizontally and vertically).
body,
html {
background-color: #181A1B;
color: white;
height: 100%;
margin: 0;
padding: 0;
}
.container {
width: 100%;
height: 100%;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
.introduction {
float: left;
}
.clearfix {
clear: both;
}
#profile-picture {
border-radius: 100%;
float: inherit;
}
#introduction-paragraph {
float: inherit;
margin-left: 10px;
margin-top: 40px;
}
<div class="container">
<div class="introduction">
<img id="profile-picture" src="https://icon-library.net/images/profile-png-icon/profile-png-icon-15.jpg" alt="profile picture">
<p id="introduction-paragraph">Test</p>
</div>
<div class="clearfix"></div>
</div>
Now if I look through the Inspector, I can see that in Firefox:
The value of float
attribute is set to left
, as it should be, since it's inheriting from .introductoin
. But in Chrome:
The value of float
attribute is set to none
, even though it understands that it's being inherited. As the result the two elements of .introductoin
are not aligned horizontally in Chrome, but they are in Firefox. How can I fix this?
Version of each browser: firefox 69.0-1
& google-chrome 77.0.3865.75-1
.