我正在将标题文本放在一个分部中。幸运的是,我在那篇课文上得到了多余的空间。当我试图增加文本的大小时,文本正在向下移动。所以在这里,我想增加我的文本大小,同时我想把它向上的除法。是否有可能移除顶部的空间并向上移动?
我试过填充顶:以负像素。但那不管用。
HTML:
<div class="stylish">
<h1> keep you stylish </h1>
</div>CSS:
.stylish{
font-family:"Brush Script MT", cursive;
font-size:1.3em;
}发布于 2014-05-05 11:17:19
您的问题不是div,而是<h1>标记。试试这个:
h1 {
margin: 0px;
padding: 0px;
}你也可以尝试:
h1 {
margin: 0;
padding: 0;
}发布于 2014-05-05 11:30:55
我建议在每个css开始时重新设置css:
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}来源
发布于 2014-05-05 11:31:11
h1
{
margin-top: 0px;
padding-top: 0px;
}或者你也可以试试这个
h1
{
margin: 0px 0px 0px 0px;//top left bottom right
padding: 0px 0px 0px 0px;
}.stylish必须有填充物:0px;即;
.stylish
{
padding:0px;
}原因:
默认情况下,每个标记都像<H1>,<P>..。为了缩小差距,我们需要外部给出margin=0px;padding =0px
更多关于边距和衬垫的参考资料
http://www.htmldog.com/guides/css/beginner/margins/
7a.htm
http://html.net/tutorials/css/lesson10.php
https://stackoverflow.com/questions/23470652
复制相似问题