css 字体改小成10px时,span元素和div之间会有一个间隙,该如何解决?

html-css026

css 字体改小成10px时,span元素和div之间会有一个间隙,该如何解决?,第1张

一看你就是初学者,一定要记得css初始化,因为各个浏览器自带的有默认的样式。

那么什么是css初始化?

其实就是将默认的样式清除掉,例如div之间有间隙等,下面给你一些css初始化的样式。你可以直接放到css里最前面直接用。

// 腾讯:

body,ol,ul,h1,h2,h3,h4,h5,h6,p,th,td,dl,dd,form,fieldset,legend,input,textarea,select{margin:0padding:0} 

 

body{font:12px"宋体","Arial Narrow",HELVETICAbackground:#fff-webkit-text-size-adjust:100%} 

 

a{color:#2d374btext-decoration:none} 

 

a:hover{color:#cd0200text-decoration:underline} 

 

em{font-style:normal} 

 

li{list-style:none} 

 

img{border:0vertical-align:middle} 

 

table{border-collapse:collapseborder-spacing:0} 

 

p{word-wrap:break-word} 

 

 

// 新浪:

body,ul,ol,li,p,h1,h2,h3,h4,h5,h6,form,fieldset,table,td,img,div{margin:0padding:0border:0} 

 

body{background:#fffcolor:#333font-size:12px margin-top:5pxfont-family:"SimSun","宋体","Arial Narrow"} 

 

ul,ol{list-style-type:none} 

 

select,input,img,select{vertical-align:middle} 

 

a{text-decoration:none} 

 

a:link{color:#009} 

 

a:visited{color:#800080} 

 

a:hover,a:active,a:focus{color:#c00text-decoration:underline} 

 

 

// 淘宝:

body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, dl, dt, dd, ul, ol, li, pre, form, fieldset, legend, button, input, textarea, th, td { margin:0 padding:0 } 

 

body, button, input, select, textarea { font:12px/1.5tahoma, arial, \5b8b\4f53 } 

 

h1, h2, h3, h4, h5, h6{ font-size:100% } 

 

address, cite, dfn, em, var { font-style:normal } 

 

code, kbd, pre, samp { font-family:couriernew, courier, monospace } 

 

small{ font-size:12px } 

 

ul, ol { list-style:none } 

 

a { text-decoration:none } 

 

a:hover { text-decoration:underline } 

 

sup { vertical-align:text-top } 

 

sub{ vertical-align:text-bottom } 

 

legend { color:#000 } 

 

fieldset, img { border:0 } 

 

button, input, select, textarea { font-size:100% } 

 

table { border-collapse:collapse border-spacing:0 }

首先可以用

{

font-family: 微软雅黑;

}

如果这样不行还可以用:

{

font-family: "Microsoft YaHei" ! important

}

使用中最好不用中文,中文的话,英文系统就显示不了了。(前提是英文系统也有这个字体)

CSS中设置的字体

考虑到兼容性,我们总会在CSS中队字体进行一些设置,这类设置往往设置在body标签上,无论是人人网,腾讯网,淘宝网,开心,新浪,网易等都是如此。以下为各个大型网站的body的字体设置:

人人网:

body{font-family:Tahoma,Verdana,STHeiTi,simsun,sans-serif}

其中simsun为中文字体。

腾讯网:

body{font-family:"宋体","Arial Narrow"}

淘宝网:

body{font:12px/1.5 tahoma,arial,sans-serif}

开心网:

body{font-family:'lucida grande',tahoma,helvetica,arial,'bitstream vera sans',sans-serif}

新浪微博:

html{font-family:Arial,Helvetica,sans-serif,"宋体"}

白社会:

body{font:12px/20px Tahoma,Verdana,Arial,sans-serif}

综合一下

body

{

font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif,"宋体"

}

0

你把它放在最下面它不就在最下面吗 你只需要一个文字居中代码就行了 text-align:center看下面这段代码

<div id="foot" style="text-align:center"

<p设搜搜为主页 | 搜搜招聘 | 服务条款 | 关于腾讯 | About Tencent </p

<pCopyright 08 1998 – 2009 Tencent. All Rights Reserved.</p</div你把这段代码粘到你body标签中的最下面的位置 看这段文字是不是在网页的最下面补充:

那你可以建个空白的div呀 或者空白的表格也成啊

比如我想空一个 宽1000px 高500px的空白

我可以这么加