在IMG之后删除换行符

Fei*_*ngo 10 html css

我在div旁边设置了一个img元素.我尝试了几种不同的方法来删除两者之间发生的换行但没有取得任何成功.任何投入将不胜感激!

CSS

#newsMainBody
{
margin-right: auto;
margin-left: auto;
background:#61bc49;
width: 750px;
height: 900px;
font-family:"sans-serif";
text-align:left;
-moz-border-radius: 10px;/*mozilla*/
z-index: 1;
white-space: nowrap;
}

#starOfMonth
{
background: #ffff99;
width: 275px;
height: 300px;
text-align: center;
font-family:"sans-serif";
white-space: normal;
}
Run Code Online (Sandbox Code Playgroud)

HTML

<div id="newsMainBody">
   <img src="img/farm.jpg" alt="Farm photo" />
   <div id="starOfMonth">
      <br />
      <font style="font-weight:bold;font-size:medium; color:Purple;">DooLittle Farms Childcare</font><br />
      <font style="font-size:small;">"We're Growing Great Kids"</font><br />
      <img id="starImg" src="img/gold-star.jpg" alt="Star of the Week" width="200" height="200"/><br />
      Our Star Of The Week!
    </div>
 </div>
Run Code Online (Sandbox Code Playgroud)

Ret*_*ser 7

加:


#newsMainBody img {
float: left;
}

#startOfMonth {
float: right;
}

并删除第一个<br /><div id="starOfMonth">,也没用(使用填充顶在CSS代替,如果你需要一些空间)