Skip to content

Instantly share code, notes, and snippets.

@dicethedev
Created November 19, 2022 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dicethedev/3aa99456bb87b8d24b815bf87828363a to your computer and use it in GitHub Desktop.
Save dicethedev/3aa99456bb87b8d24b815bf87828363a to your computer and use it in GitHub Desktop.
How do I make the left div align to left and right div align to right
<html>
<head>
<title>How do I make the left div align to left and right div align to right</title>
<style>
div {
display: flex;
justify-content: space-between;
}
.left {
text-align: left;
}
.right {
display: inline-block;
text-align: right;
}
.left, .right {
display: inline-block;
width: 50%; /* change width of each one to determine the width gap */
}
</style>
</head>
<body>
<div>
<div class="left">Some random title</div>
<div class="right"><img src="image.jpg"/></div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment