gpt4 book ai didi

html - 水平布局图像和段落

转载 作者:行者123 更新时间:2023-11-28 08:56:06 24 4
gpt4 key购买 nike

我想用图像和段落创建 Accordion 。

HTML

<div id="container">
<section id="accordion">
<div>
<input type="radio" id="check-1" name="acr" />
<label for="check-1">Hardware</label>
<article>
<div>
<img src="image/1.png">
<h1>Processor</h1>
<p>Choose the processor that best meets your performance needs. Your MacBook Pro comes as standard with the 2.5GHz dual-core Intel Core i5 processor. For even faster performance, configure your MacBook Pro with the 2.9GHz dual-core Intel Core i7
processor.</p>
</div>
</article>
</div>

使用上面的标记,图像和段落是垂直显示的。我需要水平显示它们。我将如何为此编写 CSS?

最佳答案

只需使用 CSS 向右/向左浮动您的图片。

例子:

div#container section div article div img{
float: left; /* so that it moves to the left and the text is to the right */
margin: 10px; /* so that it looks nice */
}

Working Demo

Here is a good tutorial about aligning images with text.

关于html - 水平布局图像和段落,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27119135/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com