Created
November 19, 2022 16:48
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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