【问题标题】:CSS and Placing Text Next To ImageCSS 和在图像旁边放置文本
【发布时间】:2016-01-06 21:50:05
【问题描述】:

我有一些文字和一张图片,我想将文字放在图片的右侧。 我已使图像正确浮动,但问题是我只想将 2 第一行放在图像旁边。 我希望其余文本保持在图像下方,就像关闭浮动时一样。

网址示例: http://salient.peterstavrou.com/5937-2/

我有下面的图片代码:

.audiodownload {
  width: 120px !important;
  float: left;
}

我正在使用 WordPress,页面中的 HTML 是:

 <h2>Good Audiobook</span></h2>

  Click on the image below to see if the Audiobook is available.
 <a href="https://www.youtube.com/results?search_query=The+7+Habits+of+Highly+Effective+People+audiobook" target="_blank"><img class="audiodownload" src="http://www.peterstavrou.com/wp-content/uploads/2015/10/YouTube-MP3-Audio.jpg" alt="Audiobook Download" /></a>
 If the Audiobook is available then you can download it to your computer as an .mp3 audio file by following these instructions
&nbsp;

The 7 Habits of Highly Effective People is recognized as one of the most influential audiobooks ever recorded. In this Audiobook Stephen R. Covey presents a holistic, integrated, principle-centered approach for solving personal and professional problems. 
With penetrating insights and pointed anecdotes, Stephen Covey reveals a step-by-step pathway for living with fairness, integrity, honesty and human dignity - principles that give us the security to adapt to change, and the wisdom and power to take advantage of the opportunities that change creates.

【问题讨论】:

  • 你能给我们看看你的html吗?

标签: css image text alignment


【解决方案1】:

在你想在图片下方使用的段落样式中:

p {
    clear: both;
}

指定 p 元素的左侧或右侧不允许浮动元素。来自http://www.w3schools.com/cssref/pr_class_clear.asp

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-03-04
    • 1970-01-01
    • 2016-12-22
    • 1970-01-01
    • 1970-01-01
    • 2021-07-20
    • 1970-01-01
    • 2013-09-16
    相关资源
    最近更新 更多