<html>
<style>
#MCALPmainArticleBox {
margin: 0px;
padding: 16px;
width: 980px;
font-size: 20px;
color: #666666;
font-weight: 300;
line-height: 26px;
float: left;
}
#MCALPmainArticleBoxImg {
width: 384px;
padding-right: 16px;
float: left;
}
</style>
<div id="MCALPmainArticleBox">
<a href="#"><img id="MCALPmainArticleBoxImg" src="http://dummy-images.com/abstract/dummy-480x270-Goemetry.jpg" </a> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.
</div>
</html>
&#13;
我已在上面编码了这些代码。这还不足以让我在它下面添加一些关于图像的信息。 (图像上的红色文字)。其余的黑色文本应该包裹图像和红色文本。谢谢你的帮助。
我想要这个:
答案 0 :(得分:0)
#MCALPmainArticleBox {
margin: 0px;
padding: 16px;
width: 980px;
font-size: 20px;
color: #666666;
font-weight: 300;
line-height: 26px;
float: left;
}
#MCALPmainArticleBoxImg {
width: 384px;
padding-right: 16px;
}
<div id="MCALPmainArticleBox">
<a href="#"><img id="MCALPmainArticleBoxImg" src="http://dummy-images.com/abstract/dummy-480x270-Goemetry.jpg"> </a>
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc,
</p>
</div>
这是JSFiddle
这与您想要的输出相同吗?
希望这有帮助。
答案 1 :(得分:0)
我只是添加了一个新的span
,其中包含图片的标签,并为现有元素更改了一些CSS。
#MCALPmainArticleBox {
margin: 0px;
padding: 16px;
width: 980px;
font-size: 20px;
color: #666666;
font-weight: 300;
line-height: 26px;
}
#MCALPmainArticleBoxImgOuter{
display:block;
width: 384px;
padding-right: 16px;
float: left;
text-decoration: none;
}
#MCALPmainArticleBoxImg{
max-width:100%;
}
.imageLabel{
color:red;
}
&#13;
<div id="MCALPmainArticleBox">
<a href="#" id="MCALPmainArticleBoxImgOuter">
<img id="MCALPmainArticleBoxImg" src="http://dummy-images.com/abstract/dummy-480x270-Goemetry.jpg">
<span class="imageLabel">Some label for the image</span>
</a>
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligu<br>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligu<br>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligu<br>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligu<br>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligu
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligu Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligu<br>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligu<br>
</p>
</div>
&#13;