Css设置字体

html-css012

Css设置字体,第1张

<link href="style.css" rel="stylesheet" type="text/css">其中style.css是你外部css文件名2.写在html页面的<head></head>里面<style type="text/css">*{font-size:10px} //通配符是用于定义网页所有标签的样式body{font-size:10px} // 这个样式是用于定义body中的标签样式//在html中,一般以上两种定义字体大小的方法都可以,*定义的范围会比较广一点, 你会发现很多网页有这么一行代码*{margin:0padding:0} //这个是用于更改ie的3像素bug</style>3.二楼给的写法<body style="font-size:12px">也是定义标签样式的一种方法,一般没学过css的初学者这样定义样式是比较方便的,但这样写管理起来很麻烦,代码冗杂,又长又臭,特别是代码多了以后,想修改就更麻烦了,而且代码也不美观,还可能会影响浏览速度....所以还是建议使用上面两种比较好,熟练以后就用第一种4.其实还有很多定义样式的方法,网上找找资料,慢慢学习,不难的你说的控制多层嵌套的表格,其实你可以给你要控制的单元格加个id或者class,然后把他们的样式写进css里面我简单写一下,嵌套就不写了,最讨厌表格了,实在是太麻烦了<tr><td class="type01">文字是红色的,14px</td>//class定义的样式可以多次用<td id="type01">文字是黑色的,11px</td>//id定义的样式只对一个标签有用</tr><tr class="type01">//用了上面的class样式<td>这里面的文字是红色的,14px</td></tr>在样式表中这样写他们的样式①.type01{ color:#FF0font-size:14px} //class="type01"的标签#.type01{color:#000font-size:11px} //id="type01"的标签// 写进css文件里面②<style type="text/css">

<script language="javascript">// JavaScript DocumentstartList = function() {if (document.all&&document.getElementById) {navRoot = document.getElementById("nav")for (i=0i<navRoot.childNodes.lengthi++) {node = navRoot.childNodes[i]if (node.nodeName=="LI") {node.onmouseover=function() {this.className+=" over"} node.onmouseout=function() { this.className=this.className.replace(" over", "")} } } }}window.onload=startList</script><style type=text/css><!--body { font: normal 11px verdana}ul { margin: 0padding: 0list-style: nonewidth: 150px/* Width of Menu Items */ border-bottom: 1px solid #ccc} ul li { position: relative} li ul { position: absoluteleft: 149px/* Set 1px less than menu width */ top: 0display: none}/* Styles for Menu Items */ul li a { display: blocktext-decoration: nonecolor: #777background: #fff/* IE6 Bug */ padding: 5pxborder: 1px solid #ccc/* IE6 Bug */ border-bottom: 0} /* Holly Hack. IE Requirement */* ul li { float: leftheight: 1%}* ul li a { height: 1%}/* End */li:hover ul, li.over ul { display: block} /* The magic */--></style><ul id="nav"><li><a #">Home</a></li><li><a #">About</a><ul><li><a #">History</a></li><li><a #">Team</a></li><li><a #">Offices</a></li></ul></li><li><a #">Services</a><ul><li><a #">Web Design</a></li><li><a #">Internet Marketing</a></li><li><a #">Hosting</a></li><li><a #">Domain Names</a></li><li><a #">Broadband</a></li></ul></li><li><a #">Contact Us</a><ul><li><a #">United Kingdom</a></li><li><a #">France</a></li><li><a #">USA</a></li><li><a #">Australia</a></li></ul></li></ul>        lishixinzhi/Article/program/Java/Javascript/201311/25433