The items just stay to the left instead of spreading out. Also, I’m using Google Icons, and the icons won’t show up unless I’m using the base tag in the head section (the domain name isn’t registered); is this normal? My browser is Microsoft Edge.
header {
display: flex;
justify-content: space-between;
width: 100%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Brain Archive</title>
<meta charset="UTF-8">
<base href="https://www.brainarchive.com/">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="brain_archive.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,[email protected],100..700,0..1,-50..200" />
</head>
<body>
<header>
<span>Brain Archive</span>
<span>
<span class="material-symbols-outlined">search</span>
<span class="material-symbols-outlined">menu</span>
</span>
</header>
<main>
</main>
</body>
</html>
3
Answers
Seems to work perfectly. "Brain Archive" is on the left, and the icons are on the right.
This is a slight alteration to @BrettDonald answer – the icons are also spread evenly.
This is achieved by setting their span parent to display:contents which tells flex to include the children of that element.