比如:
h1{color:red}
h1就是选择器,意思是只要遇到h1,就使用该CSS的规则
color:red:这个事声明
color:这个是属性
red:这个是值
2
OK,我们先来分析选择器。
1,打开记事本,并在其中输入必要信息,完整代码如下:<!DOCTYPE html><html><head><meta charset="utf-8"><title></title>
<body><header><img src="molihua.jpg"width="412" height="291"</header><article><header><h2>茉莉花</h2><p>作者:宋 · 刘克庄 </p></header><hr/><p>曾与瑶姬约。恍相逢、翠裳摇曳,珠韝联络。风露青冥非人世,揽结玉龙骖鹤。
爱万朵、千条纤弱。
祷祝花神怜惜取,问开时、晴雨须斟酌。枝上雪,莫消却。
恼人匹似中狂药。
凭危栏、烛光交映,乐声遥作。身上春衫香薰透,看到参横月落。
算茉莉、犹低一著。坐有缑山王郎子,倚玉箫、度曲难为酢。君不饮,铸成错。</p><h3>清平乐</h3><p>冰轮万里。云卷天如洗。先向海山生大士。却诞卯金之子。冰盆荔子堪尝。胆瓶茉莉尤香。震旦人人炎热,补陀夜夜清凉。</p><dl><dt>《浣溪沙》</dt><dd>南国幽花比并香。直从初夏到秋凉</dd><dt>《鹧鸪天》</dt><dd>携靓侣,泛轻航。棹歌惊起野鸳鸯</dd><dt>《真珠帘》</dt><dd>茉莉芰荷香,拍满笙箫院。</dd>
</dl></article><footer>2019.9.6</footer></body></html>
启动浏览器运行后,大家会发现界面并不美观,文字看着也比较乱。
为了解决这个问题,可以在界面添加css规则,让界面更好看,更标准化,将下面的代码块添加到记事本中,位置在<head>和<head/>也就是头部之间:
<style type="text/css">body{ background:gray} h2{ text-align:center} header{ text-align:center} article p{ text-indent:2em} footer{ font-size:12pxfont-align:center} </style>
<style type="text/css">body{ background:#fffpadding:0margin:0font-size:12px}
img{ border:0padding:0margin:0}
ul{list-style:none}
.login_bg{ background:url(<%=path%>financemanage/images/login_new/login_bg.gif) repeat-xheight:591px}
.dl_bg{ background:url(<%=path%>financemanage/images/login_new/dlbg.jpg) no-repeat center top}
.diwen{ background:url(<%=path%>financemanage/images/login_new/diwen.gif) repeat-x}
.usename{ font-size:14pxcolor:#0e3c00}
.dl_text{ width:145pxheight:17pxbackground:url(<%=path%>financemanage/images/login_new/text.gif) repeat-x centerborder:1px solid #1c5302}
.dl_but{ width:75pxheight:50pxbackground:url(<%=path%>financemanage/images/login_new/dlbut.gif) no-repeatborder:0 nonecursor:pointer}
</style>
<script language="javascript" type="text/javascript">
var count = 0
function submit_onclick(obj){
if (count == 0) {
//alert("MAC:" + document.forms[0].MACAddr.value)
obj.submit()
count ++
}
}
function submit2() {
if (count != 0) {
return false
}
if (event.keyCode==13) {
document.forms[0].submit()
}
}
</script>
<!-- script FOR="foo" EVENT="OnObjectReady(objObject,objAsyncContext)" LANGUAGE="JScript">
if(objObject.IPEnabled != null &&objObject.IPEnabled != "undefined" &&objObject.IPEnabled == true)
{
if(objObject.MACAddress != null &&objObject.MACAddress != "undefined")
MACAddr = objObject.MACAddress
if(objObject.IPEnabled &&objObject.IPAddress(0) != null &&objObject.IPAddress(0) != "undefined")
IPAddr = objObject.IPAddress(0)
}
</script>
<object classid="CLSID:76A64158-CB41-11D1-8B02-00600806D9B6" id="locator" VIEWASTEXT></object>
<object classid="CLSID:75718C9A-F029-11d1-A1AC-00C04FB6C223" id="foo"></object>
<script LANGUAGE="JScript">
var service = locator.ConnectServer()
var MACAddr
var IPAddr
service.Security_.ImpersonationLevel=3
service.InstancesOfAsync(foo, 'Win32_NetworkAdapterConfiguration')
</script>
-->
</head>
<body onKeyPress="submit2()">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="login_bg">
<tr>
<td height="135" align="center" valign="top"><img src="<%=request.getContextPath()%>/financemanage/images/login_new/logo.jpg" width="939" height="135" /></td>
</tr>
<tr>
<td height="391" align="center" valign="top" class="dl_bg">
<html:form action="/financemanage/login.do" method="post">
<table width="320" height="70" border="0" cellspacing="0" cellpadding="0" style="margin-top:120pxmargin-left:40px">
<tr>
<td width="100" align="center" class="usename">操作员号:</td>
<td width="184" align="left"><input name="tlrno" type="text" class="dl_text" maxlength="8" tabindex="1"/></td>
<td width="75" rowspan="2"><input name="Submit" type="button" onclick="submit_onclick(this.form)" value="" class="dl_but" tabindex="3"/></td>
</tr>
<tr>
<td align="center" class="usename">密 码:</td>
<td align="left"><input name="pwd" type="password" class="dl_text" maxlength="10" tabindex="2"/>
<%-- input type="hidden" name="MACAddr"/>--%>
</td>
</tr>
<tr>
<td></td>
<td colspan="2"><font size="2"><html:errors/></font></td>
</tr>
</table>
</html:form>
</td>
</tr>
<tr>
<td height="65" class="diwen"> </td>
</tr>
</table>
你可以自己换一下背景颜色或者背景图片 其他的都挺好 这是一个给银行操作员登录的界面 你看看吧