Skip to content

Instantly share code, notes, and snippets.

@singhArmani
Last active July 30, 2019 11:50
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/5e655fceb7c0d004ef8df11395728fc7 to your computer and use it in GitHub Desktop.
Save singhArmani/5e655fceb7c0d004ef8df11395728fc7 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":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment