I have tried display :flex; with justify-content: space-between, align-items:center;
Also tried changing width , height, display- inline, inline-block but couldn’t figure out.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Clone@Netflix</title>
<link rel="stylesheet" href="netflix.css">
</head>
<body>
<header>
<nav class="navigation">
<h2>NETFLIX</h2>
<span class="language">
<select name="#" id="lang_inner">
<option value="en">English</option>
<option value="hi">Hindi</option>
<option value="ar">Arabic</option>
<option value="es">Espaniol</option>
</select>
</span>
<button class="signin_button">Sign in</button>
</nav>
</header>
</body>
</html>
*{
margin:0;
padding:0;
box-sizing: border-box;
font-family: sans-serif;
}
header{
position:absolute;
display:flex;
justify-content: space-between;
align-items: center;
height:100vh;
width: 100%;
}
2
Answers
You can do it with
float: left;
:display: flex
will work, but you need to use it differently. It only applies to an element’s immediate children, not to anything nested more deeply than that, so in your code, thedisplay: flex
property in theheader
only applies to thenav
element’s layout and not to thenav
‘s children, and those children are the elements you’re trying to control.Instead, you should put it on the
nav
element, like so:Then adjust
justify-content
if you don’t want those three elements spaced miles apart from each other.