0

我要做的就是在方程式周围获得一些垂直间距。我想设置等式之前出现的一定数量的空间和之后出现的一定数量。我正在尝试各种各样的东西,但它似乎总是对一些疯狂的事情有用。我了解保证金崩溃,但显然不止如此。我已经放置了一些荒谬的空间来说明古怪。任何人都可以帮忙吗?

calcStyle.css:

body {font-size:180%;}
h2 {font-size:250%;}
h1 {font-size:170%;}
table {font-size:150%}
body {margin-left:30px;}
body {margin-right:30px;}
body {background-color:#ffffff;}
blockquote {
    margin-left 55px;
    margin-right 55px;
    font-style: italic;}
h1 {color:#222222;}
td {
    text-align: center;
    padding-left: 12px;
    padding-right: 12px;
    padding-top: 4px;
    padding-bottom: 4px;
}

th {
    text-align: center;
    padding-left: 12px;
    padding-right: 12px;
    padding-top: 4px;
    padding-bottom: 4px;
}
equation {
    margin-left:10px;
    margin-right:10px;
    padding-top:100px;
    padding-bottom:100px;
    padding-left:100px;
    padding-right:100px;
    margin-top:100px;
    margin-bottom:100px;
    border:50px #eeeeee;
    background-color: #ddddaa
}

html:

<head>
    <link rel="stylesheet" type="text/css" href="calcStyle.css" />
</head>
<body>
    easy math: <br />

    <equation>
        2+2=4
    </equation>
    <br /> 
    hard math:
    <br />
    <equation>
        3+3=6
    </equation>
    <br /><br />
</body>

结果:

在此处输入图像描述

4

3 回答 3

1

你有你的利润。我已经把它们修好

通常,您可以将边距编写为:margin: top right bottom left而不是它们的相关margin-*属性 - 其中顶部、右侧、底部和左侧表示您可以根据需要提供的像素宽度值。

于 2011-12-25T04:25:44.770 回答
1

我建议使用 div 并将类设置为“方程式”,因​​为“方程式”不是有效的 html 标记。一个例子是here

easy math:

<div class="equation">
    2+2=4
</div>

hard math:
<div class="equation">
    3+3=6
</div>
于 2011-12-25T04:35:01.957 回答
0

添加display: inline-block;到您的equation. 那将解决它。IE

在你的 CSS 中:

equation {
  ...
  display: inline-block;
  ...
}

小提琴:http: //jsfiddle.net/VGwwL/

于 2011-12-25T04:41:46.303 回答