JSFiddle - React, Tailwind, and code Playground

by Daniel Tan

HTML

<div id="sidebar-no-gap">
    <div class="sidebar">
			<p>Bear claw jelly faworki topping applicake toffee gummies. Chocolate ice cream bonbon donut. Faworki croissant tootsie roll topping pie. Candy canes halvah marzipan. Sweet roll tart tootsie roll powder toffee jujubes gingerbread sugar plum pudding. Chocolate cake chupa chups candy pastry jelly. Sesame snaps tootsie roll powder gummies. Pastry jelly-o jujubes bear claw muffin marshmallow candy. Cheesecake apple pie pudding soufflé applicake lemon drops jujubes icing. Oat cake faworki danish chupa chups. Danish lemon drops cheesecake gummi bears pie sugar plum. Danish cookie gingerbread. Toffee halvah cotton candy chupa chups bear claw cotton candy wafer. Carrot cake pastry candy croissant pastry.</p>
		</div>
	<h2>Sidebar with no gap</h2>
	<p>The sidebar is floated to the right, and has a left-margin, which kicks the text back away from the edge of the sidebar, but that does not affect the edge of block-level elements that overlap it. Note the pink background of the notice banner edges right up to the yellow box (and indeed goes all the way under it, as the small right-margin shows).</p>
	<div class="notice"><p>This is a notice that you should pay attention to.</p></div>
	<p>Bear claw jelly faworki topping applicake toffee gummies. Chocolate ice cream bonbon donut. Faworki croissant tootsie roll topping pie. Candy canes halvah marzipan. Sweet roll tart tootsie roll powder toffee jujubes gingerbread sugar plum pudding. Chocolate cake chupa chups candy pastry jelly. Sesame snaps tootsie roll powder gummies. Pastry jelly-o jujubes bear claw muffin marshmallow candy. Cheesecake apple pie pudding soufflé applicake lemon drops jujubes icing. Oat cake faworki danish chupa chups. Danish lemon drops cheesecake gummi bears pie sugar plum. Danish cookie gingerbread. Toffee halvah cotton candy chupa chups bear claw cotton candy wafer. Carrot cake pastry candy croissant pastry.</p>
</div>

<div id="sidebar-gap">
<div...

CSS

.sidebar { float:right; width:40%; padding:1em; margin-left:1em; background-color:#FFC; }
.sidebar p { margin:0; }
.notice { background-color:#FAA; padding:0.3em 0.6em; margin:1em 0; overflow:auto; }
.notice p { margin:0; }

#sidebar-no-gap { padding-bottom:2em; margin-bottom:3em; border-bottom:solid 1px #CCC; }
#sidebar-no-gap .sidebar { margin-right:5px; }
#sidebar-gap .notice { width:52%; }