Stop text from wrapping around an image
I want the text not to wrap around the image. Is there a way to do this without using it margin
?
img {
margin-bottom: 2.5em;
}
<strong><img style="float: left;" src="https://www.google.com/images/srpr/logo11w.png" width="100" height="67" />Text here. Text here. Text here. Text here.
<br />Text here. Text here. Text here. Text here. Text here. Text here.
<br />Text here. Text here. Text here. Text here.Text here. Text here.Text here. Text here.Text here. Text here.Text here. Text here.
<br />Text here. Text here.Text here. Text here.Text here. Text here.
source to share
You will need to wrap your text in your own container.
Since yours <img>
moves to the left, you can use overflow: hidden
in the container you just added to avoid text wrapping.
However, block elements do not have to be children of elements <strong>
, you can rethink this tag.
img {
width:100px;
height:67px;
float:left;
}
div {
overflow:hidden;
}
<article>
<img src="https://www.google.com/images/srpr/logo11w.png" />
<div>
Text here. Text here. Text here. Text here.<br />
Text here. Text here. Text here. Text here. Text here. Text here.<br />
Text here. Text here. Text here. Text here.Text here. Text here.Text here. Text here.Text here. Text here.Text here. Text here.<br />
Text here. Text here.Text here. Text here.Text here. Text here.
Text here. Text here. Text here. Text here.<br />
Text here. Text here. Text here. Text here. Text here. Text here.<br />
Text here. Text here. Text here. Text here.Text here. Text here.Text here. Text here.Text here. Text here.Text here. Text here.<br />
Text here. Text here.Text here. Text here.Text here. Text here.
</div>
</article>
source to share
Typically, here are some guidelines for improving your css and html skills:
1) Always separate images and texts in the corresponding tags: <img src="">
for images and <p>
or <div>
or <span>
for texts.
2) As a general rule, separate your content (html) and your style (css) as much as possible.
3) To understand how CSS works, you need to study the window model . Here's a great article to help you: http://css-tricks.com/the-css-box-model/
This box model will help you with your problem.
source to share
Using a WordPress plugin
Paste the Text[clearboth]
into the editor (it will not be removed by the Visual editor ) with
- ClearBoth plugin or
- plugin Simple Breaks .
source to share