Skip to content

Instantly share code, notes, and snippets.

@ravisiyer
Created April 15, 2024 10:40
Show Gist options
  • Save ravisiyer/cd865c67067275b3d12d76bb071f2dd4 to your computer and use it in GitHub Desktop.
Save ravisiyer/cd865c67067275b3d12d76bb071f2dd4 to your computer and use it in GitHub Desktop.
CSS: Putting H2 on left and link on right of same line
<!DOCTYPE html>
<html>
<head>
<title>H2 and link same line</title>
<style>
div {
background: #dbdbdb;
display: flex;
justify-content: space-between;
align-items: center;
}
</style>
</head>
<body>
<div>
<h2>H2</h2>
<a href="#">Some link</a>
</div>
<p>
H2 inline left-aligned with right-aligned and vertically centered link
</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment