Answer the question
In order to leave comments, you need to log in
How to size a flex container to its content by removing extra space?
Here is the structure of the header:
<header class="header">
<div class="container">
<div class="header__body">
<div class="header__logo-name">
<a href="#" class="header__logo">
<img src="img/mail.png" alt="">
</a>
<div class="header__name">My mail</div>
</div>
<div class="header__user">
<div class="user__mail">[email protected]</div>
<div class="user__icon">
<img src="img/account.png" alt="">
</div>
</div>
</div>
</div>
</header>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body, html {
height: 100%;
font-family: 'Roboto', sans-serif;
}
.container {
width: 90%;
margin: 0 auto;
}
.header__body {
display: flex;
justify-content: space-between;
align-items: center;
}
.header__logo-name,
.header__user {
display: flex;
align-items: center;
}
.header__logo,
.user__icon {
flex: 0 0 40px;
}
.header__logo img,
.user__icon img {
max-width: 100%;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question