Picture of corresponding example
I want to move the Hello text, next to the border of CapName instead of underneath it. Any ideas?
<div className='h-screen dark:bg-gray-900 grid items-center justify-items-center'>
<div className='h-20 w-3/5 dark:bg-gray-500 border-2'>
<div>
<div className='border-2 p-2 w-2/5 h-full flex items-center '>
<h1 className='text-2xl text-white'>Capsule # / CapName</h1>
</div>
<div>
<h1 className='text-white'>Hello</h1>
</div>
</div>
</div>
</div>
I have tried moving the div of the Hello text other places but they remove the Hello text completely out of the large div container.
2
Answers
Are you looking for something like this?
And a couple of alternate ideas for you…
Center With Flexbox
Layout Using Grid
Is this layout you want?
You need to include the
flex
property to the parent div containing the other 2 children div like shown with comment in belowYour code
Corrected code
see live code here