简体   繁体   English

段落左侧的浮动图像(文本)

[英]Float Image to Left of Paragraph (Text)

I have an image that I need to float left and have the paragraph of text automatically show up on the right. 我有一幅需要向左浮动的图像,并且文本段落自动显示在右侧。

For instance: 例如:

<div class:"floated-image"><img src="img/fox.png" alt="Fox logo">
<p>The quick brown fox jumped over the log. <a>The fox is here.</a>
</p></div>

 .floated-image{
    float: left;
 }

Unfortunately, this is not working any ideas? 不幸的是,这行不通吗? I won't get my materials for school till Monday and I would like to work this out!! 直到星期一我都不会上学的材料,我想解决这个问题!! I've done everything else but this code and I have attempted to place the code within the paragraph. 除此代码外,我已完成所有其他操作,并且尝试将代码放在该段中。 CSS: CSS:

<div class:"floated-image"> is wrong, <div class="floated-image"> is correct. <div class:"floated-image">是错误的, <div class="floated-image">是正确的。

Use this code : 使用此代码:

.floated-image img {
    float: left;
 }

 .floated-image img { float: left; width: 200px; } 
 <div class="floated-image"> <img src="http://justcuteanimals.com/wp-content/uploads/2016/10/baby-bear-pictures-cute-animal-pics.jpg" alt="Fox logo"> <p>The quick brown fox jumped over the log. <a>The fox is here.</a></p> </div> 

IF you want .floated-image be floated too. 如果您也想浮动.floated-image

Use this code : 使用此代码:

.floated-image {
    float: left;
    border: 1px solid;
 }

 .floated-image img {
    float: left;
    width: 200px;
 }

 .floated-image { float: left; border: 1px solid; } .floated-image img { float: left; width: 200px; margin-right:5px; } 
 <div class="floated-image"> <img src="http://justcuteanimals.com/wp-content/uploads/2016/10/baby-bear-pictures-cute-animal-pics.jpg" alt="Fox logo"> <p>The quick brown fox jumped over the log. <a>The fox is here.</a></p> </div> 

Try this : 尝试这个 :

<img style="height: 200px; width: 200px; float: left;" src="https://developers.google.com/search/images/searchHome-Amp.svg" alt="Fox logo">


<p>The quick brown fox jumped over the log. <a>The fox is here.</a>
</p>

like this? 像这样? it can be display flex , inline-flex , -webkit-box 它可以显示flexinline-flex-webkit-box

  .floated-image { float: left; display:flex; } 
 <div class="floated-image"> <img src="https://static.xx.fbcdn.net/rsrc.php/v1/yi/r/odA9sNLrE86.jpg" alt="Fox logo"> <p>The quick brown fox jumped over the log. <a>The fox is here.</a> </p> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM