html - 无法将两个 div 并排放置,尝试了一切

标签 html css

我想把文字放在图片的右边,图片和文字应该放在页面的右边一点,但这对我来说不起作用。

<div id="container">

<div class="desc">
    <div>
        <img class="imgD" src="C:\Users\Hadia\Dropbox\college\unit 14 Webdesign\images\red-lipstic.jpg"/>
    </div>
    <div class=".introHeader">
        <h4> Red Lipstic | MAC </h4>
        <p class="price">&#163;20.00</p>
    </div>
    <div>
        <p >Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. </p>
    </div>
</div>

</div>

http://jsfiddle.net/6p1k0cqa/

最佳答案

新建一个包含文本(the和两个

),然后调用

width: 33%
float: left;

在图像 div 和

width: 60%
float: right;

在文本 div 上,根据需要调整宽度。此外,对于您在下方添加的任何内容,请务必

clear: both;

关于html - 无法将两个 div 并排放置,尝试了一切,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28140264/

相关文章:

javascript - 如何在 ng-repeat 中设置表单输入值?

javascript - document.ready 用于使用单个 JavaScript 文件的多种表单

jquery - 如何在悬停时使用 calc 旋转图像 CSS/Jquery

html - CSS 空白 : pre not working as expected

css - 在 CSS @import 指令中包含 LESS 变量

css - 在 Sass 3.2 之后是否有从普通选择器扩展的有效用例?

javascript - 带有粘性页眉、页脚、列和可滚动主体(X 和 Y)的 HTML 表格

html - 如何使图像适合幻灯片放映的容器?

html - 为什么我不能悬停?

css - 如何使用 mini-css-extract-plugin 将导入的 css 和从 scss 生成的 css 合并到一个文件中?