Home >Web Front-end >HTML Tutorial >Can any hero give me some advice? . . _html/css_WEB-ITnose

Can any hero give me some advice? . . _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:22:351028browse

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" mrc="text/html; charset=gb2312" /><style type="text/css"><!--body { padding:0; margin:0; }a.oyj-clj:link{color:#FFFFFF;}a.oyj-clj:visited{color:#FFFFFF;}a.oyj-clj:hover{color:#FFFF00;}a.oyj-clj:active{color:#FFFFFF;}a.oyj-clj:link{text-decoration:none;} #oyj-oyj-ul {width:1000px;background-color:#000000;}#oyj-logo {padding-top:10px;margin-left:10px;height:109px;width:255px;position:absolute;}#oyj-huanying {height:20px;width:1000px;padding-top:10px;margin-left:0px;font-size:12px;color:#FFFFFF;}#oyj-ding {height:25px;width:1000px;}#oyj-zhuce {font-size:12px;padding-top:0;width:80px;height:20px;float:right;color:#FFFFFF;}#oyj-tel {font-size:12px;width:100px;height:20px;float:right;color:#ffffff;}#oyj-menu {height:20px;width:600px;padding-top:80px;margin-left:400px;}#oyj-menu ul li {color: #FFFFFF;float: left;font-size: 12px;	padding:0; 	margin:0;	list-style:none;}#oyj-menu ul {margin:0px auto 0px auto;padding:0; 	margin:0;	float:right;}#oyj-tel {font-size:12px;color:#ffffff;height:20px;width:300pxpadding-top:50px;margin-left:700px;}#oyj-ul {line-height: 24px;list-style-type: none;background:#666;}#oyj-ul a {display: block;width: 80px;text-align:center;}#oyj-ul a:link {color:#ffffff;/*未点击时链接字体颜色*/text-decoration:none;}#oyj-ul a:visited {color:#FFFFff;text-decoration:none;}#oyj-ul a:hover {color:#FFFF00;text-decoration:none;font-weight:bold;}#oyj-ul li {float: left;width: 80px;background:#FF0099;/*主导航条背景*/}#oyj-ul li a:hover {background:#FF66CC;/*鼠标移位颜色*/}#oyj-ul li ul {line-height: 27px;list-style-type: none;text-align:left;left: -999em;width: 80px;position: absolute;}#oyj-ul li ul li {float: left;width: 100px;background: #000000;/*子菜单背景*/}#oyj-ul li ul a {display: block;width: 100px;text-align:center}#oyj-ul li ul a:link {color:#ffffff;text-decoration:none;}#oyj-ul li ul a:visited {color:#ffffff;text-decoration:none;}#oyj-ul li ul a:hover {color:#F3F3F3;text-decoration:none;font-weight:normal;background:#C00;}#oyj-ul li:hover ul {left: auto;}#oyj-ul li.sfhover ul {left: auto;}#content {clear: left;}--></style><script type=text/javascript><!--//--><![CDATA[//><!--function menuFix() {var sfEls = document.getElementById("oyj-ul").getElementsByTagName("li");for (var i=0; i<sfEls.length; i++) {sfEls[i].onmouseover=function() {this.className+=(this.className.length>0? " ": "") + "sfhover";}sfEls[i].onMouseDown=function() {this.className+=(this.className.length>0? " ": "") + "sfhover";}sfEls[i].onMouseUp=function() {this.className+=(this.className.length>0? " ": "") + "sfhover";}sfEls[i].onmouseout=function() {this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"),"");}}}window.onload=menuFix;//--><!]]></script><body><div id=oyj-header style="width: 100%; background-color:#000000; height:129px;"><div id=oyj-oyj-ul style="width:1000px;  margin:0 auto;"><div id=oyj-ding><div id=oyj-huanying>*欢迎来到达诚网络,我们会用我们的真诚为您服务*                                                                                                                                                                                                                                                                         联系电话:18672175995<div id=oyj-zhuce><a href="#" class="oyj-clj">登陆</a><a href="#" class="oyj-clj">注册</a></div><div align="right"></div></div></div><div id=oyj-logo><img src="1.png" width="252" height="109" /></div><div id=oyj-menu><ul id="oyj-ul"><li><a href="#">首页</a></li><li><a href="#">虚拟主机</a><ul><li><a href="#">国内主机</a></li><li><a href="#">香港主机</a></li><li><a href="#">美国主机</a></li></ul></li><li><a href="#">云VPS</a><ul><li><a href="#">国内云VPS</a></li><li><a href="#">香港云VPS</a></li><li><a href="#">美国云VPS</a></li></ul></li><li><a href="#">免费CDN</a></li><li><a href="#">服务器租用</a><ul><li><a href="#">国内服务器租用</a></li><li><a href="#">香港服务器租用</a></li><li><a href="#">美国服务器租用</a></li></ul></li><li><a href="#">帮助中心</a></li></ul></div></div></div></body></head>

在oyj-logo上 CSS有position:absolute;在本地预览页面正常,在服务器预览会错位,怎样修改达到完美效果?


回复讨论(解决方案)

你那么多 是用来做什么的?定位的么?用空格来定位?好吧,I have no words to say...

贴个你说的乱的网址瞧瞧

贴个你说的乱的网址瞧瞧
http://oyj424.ceshiyuming.yousn-cn.vip3237.net/templets/default/header.html

试试加个top试试

#oyj-logo {padding-top:10px;margin-left:10px;height:109px;width:255px;position:absolute;top:15px;}

用你给的网页另存为改的:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" mrc="text/html; charset=gb2312" /><style type="text/css"><!--body { padding:0; margin:0; }a.oyj-clj:link{color:#FFFFFF;}a.oyj-clj:visited{color:#FFFFFF;}a.oyj-clj:hover{color:#FFFF00;}a.oyj-clj:active{color:#FFFFFF;}a.oyj-clj:link{text-decoration:none;} #oyj-oyj-ul {width:1000px;background-color:#000000;}#oyj-logo {	padding-top:10px;	margin-left:10px;	height:109px;	width:255px;	position:absolute;	zoom:1;	top:15px;}#oyj-huanying {height:20px;width:1000px;padding-top:10px;margin-left:0px;font-size:12px;color:#FFFFFF;}#oyj-ding {height:25px;width:1000px;}#oyj-zhuce {font-size:12px;padding-top:0;width:80px;height:20px;float:right;color:#FFFFFF;}#oyj-tel {font-size:12px;width:100px;height:20px;float:right;color:#ffffff;}#oyj-menu {height:20px;width:600px;padding-top:80px;margin-left:400px;}#oyj-menu ul li {color: #FFFFFF;float: left;font-size: 12px;	padding:0; 	margin:0;	list-style:none;}#oyj-menu ul {margin:0px auto 0px auto;padding:0; 	margin:0;	float:right;}#oyj-tel {font-size:12px;color:#ffffff;height:20px;width:300pxpadding-top:50px;margin-left:700px;}#oyj-ul {line-height: 24px;list-style-type: none;background:#666;}#oyj-ul a {display: block;width: 80px;text-align:center;}#oyj-ul a:link {color:#ffffff;/*未点击时链接字体颜色*/text-decoration:none;}#oyj-ul a:visited {color:#FFFFff;text-decoration:none;}#oyj-ul a:hover {color:#FFFF00;text-decoration:none;font-weight:bold;}#oyj-ul li {float: left;width: 80px;background:#FF0099;/*主导航条背景*/}#oyj-ul li a:hover {background:#FF66CC;/*鼠标移位颜色*/}#oyj-ul li ul {line-height: 27px;list-style-type: none;text-align:left;left: -999em;width: 80px;position: absolute;}#oyj-ul li ul li {float: left;width: 100px;background: #000000;/*子菜单背景*/}#oyj-ul li ul a {display: block;width: 100px;text-align:center}#oyj-ul li ul a:link {color:#ffffff;text-decoration:none;}#oyj-ul li ul a:visited {color:#ffffff;text-decoration:none;}#oyj-ul li ul a:hover {color:#F3F3F3;text-decoration:none;font-weight:normal;background:#C00;}#oyj-ul li:hover ul {left: auto;}#oyj-ul li.sfhover ul {left: auto;}#content {clear: left;}--></style><script type=text/javascript><!--//--><![CDATA[//><!--function menuFix() {var sfEls = document.getElementById("oyj-ul").getElementsByTagName("li");for (var i=0; i<sfEls.length; i++) {sfEls[i].onmouseover=function() {this.className+=(this.className.length>0? " ": "") + "sfhover";}sfEls[i].onMouseDown=function() {this.className+=(this.className.length>0? " ": "") + "sfhover";}sfEls[i].onMouseUp=function() {this.className+=(this.className.length>0? " ": "") + "sfhover";}sfEls[i].onmouseout=function() {this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"),"");}}}window.onload=menuFix;//--><!]]></script><body><div id=oyj-header style="width: 100%; background-color:#000000; height:129px;"><div id=oyj-oyj-ul style="width:1000px;  margin:0 auto;"><div id=oyj-ding><div id=oyj-huanying>*欢迎来到达诚网络,我们会用我们的真诚为您服务*                                                                                                                                                                                        联系电话:11111111<div id=oyj-zhuce><a href="#" class="oyj-clj">登陆</a><a href="#" class="oyj-clj">注册</a></div><div align="right"></div></div></div><div id=oyj-ding2 style="width:1000px; height:109;"><div id=oyj-logo><img src="http://oyj424.ceshiyuming.yousn-cn.vip3237.net/1.png" width="252" height="109" /></div><div id=oyj-menu><ul id="oyj-ul"><li><a href="#">首页</a></li><li><a href="#">虚拟主机</a><ul><li><a href="#">国内主机</a></li><li><a href="#">香港主机</a></li><li><a href="#">美国主机</a></li></ul></li><li><a href="#">云VPS</a><ul><li><a href="#">国内云VPS</a></li><li><a href="#">香港云VPS</a></li><li><a href="#">美国云VPS</a></li></ul></li><li><a href="#">免费CDN</a></li><li><a href="#">服务器租用</a><ul><li><a href="#">国内服务器租用</a></li><li><a href="#">香港服务器租用</a></li><li><a href="#">美国服务器租用</a></li></ul></li><li><a href="#">帮助中心</a></li></ul></div></div></div></div></body></head>

改了两个地方:
1
#oyj-logo {
    padding-top:10px;
    margin-left:10px;
    height:109px;
    width:255px;
    position:absolute;
    zoom:1;
    top:15px;
}
2
div id=oyj-ding2删除position:absolute

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn