如何使用CSS并排放置两个元素 [英] How to position two elements side by side using CSS

查看:1168
本文介绍了如何使用CSS并排放置两个元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要将一个段落放在Google地图的< iframe> 右侧。

I want to position a paragraph to the right of an <iframe> of a Google map.

我不知道如何显示我的代码,所以这里是我想要的屏幕截图:

I do not know how to show my code, so here is a screenshot of what I want:

推荐答案

只需使用浮动风格。将您的google地图iframe放在一个div类中,并在另一个div类中的段落,然后应用以下CSS样式到这些div类(不要忘记清除浮动效果后的块,不要让它们在下面麻烦) :

Just use the float style. Put your google map iframe in a div class, and the paragraph in another div class, then apply the following CSS styles to those div classes(don't forget to clear the blocks after float effect, to not make the blocks trouble below them):

css

.google_map,.paragraph {
    float: left;
}
.clearfix{
    clear:both
}

html

<div class="google_map">
      <iframe></iframe>
</div>
<div class="paragraph">
      <p></p>
</div>
<div class="clearfix"></div>

这篇关于如何使用CSS并排放置两个元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆