Skip to content

Instantly share code, notes, and snippets.

@singhArmani
Last active July 22, 2019 02:37
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 singhArmani/bc7f7c699616bbaafa516aacb85a9351 to your computer and use it in GitHub Desktop.
Save singhArmani/bc7f7c699616bbaafa516aacb85a9351 to your computer and use it in GitHub Desktop.
Untitled
.first {
padding: 10px;
height: 300px;
margin: 10px 30px 30px 10px;
background: red;
box-shadow: 0 0 0 10px gold;
width: 100px;
text-align: center;
float: left
}
.news {
background: gold;
border: 2px solid purple;
}
.news img {
float: left;
}
.news p {
float: right;
}
.clear {
clear: both;
}
<div class="news">
<img src="https://fakeimg.pl/100/" alt="my pic" />
<p>Some text</p>
<br class="clear" />
floats take no space as they are taken out of normal document
flow. If we don't use break element with clear "both" the "news" wrapper div will collapse.
Try removing br element and see what happens.
</div>
// alert('Hello world!');
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"html"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment