2011-12-25 26 views
0

我想要做的是讓方程周圍有一些垂直間距。我想設置出現在方程之前的一定數量的空間以及之後的一定數量的空間。我正在嘗試各種各樣的東西,但它似乎總是做一些瘋狂的事情。我瞭解融資融券的情況,但顯然不止如此。我已經投入了一些荒謬的空間來說明這種瘋狂。誰能幫忙?html和css試圖讓我的方程周圍有一些垂直空間

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> 

結果:

enter image description here

+0

有什麼問題嗎? – Blender 2011-12-25 04:20:08

+0

只是一個提示 - 您可以一次設置所有4個邊距:'邊距:Tpx Rpx Bpx Lpx'其中T,R,B,L是頂部,右側,底部和左側邊距。填充相同。 – 2011-12-25 04:20:33

回答

1

你有你的利潤了。我已經修復了他們here

一般而言,您可以編寫像邊框:margin: top right bottom left的邊距,而不是其盟友的margin-*屬性 - 其中頂部,右側,底部和左側表示您可以根據需要提供的像素寬度值。

1

我會推薦使用div並將類設置爲'equation',因爲'equation'不是有效的html標記。一個例子是here

easy math: 

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

hard math: 
<div class="equation"> 
    3+3=6 
</div>