浮动:正确地混淆我的中心文本 [英] Float:right messing up my centered text

查看:119
本文介绍了浮动:正确地混淆我的中心文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我居中的文本运行到一个浮点数时,它使用float的边缘作为它的新边框而不是页面的边缘。

When my centered text runs into a float, it uses the edge of the float as its new border instead of the edge of the page.

例如, / p>

For example,

<div style="float:right; width:60px; height:60px; background-color:blue"></div>
    <h2 style="text-align:center">Section 1</h2>
        <p>
            Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.
        </p>
    <h2 style="text-align:center">Section 2</h2>
        <p>
            Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.
        </p>
</div>

如何使两个h2排成一行?

How can I make both h2's line up?

推荐答案

<h2 style="text-align:center;margin-left:60px">Section 1</h2>

这篇关于浮动:正确地混淆我的中心文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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