标题:
CSS仿淘宝首页导航条布局效果
[打印本页]
作者:
php
时间:
2007-12-17 17:16
标题:
CSS仿淘宝首页导航条布局效果
<
style
>
/
*
www
.
zishu
.
cn 子鼠
*
/
body
{
font
-
size
:
12px
;
text
-
align
:
center
;
margin-top:30px
;
font
-
family:Verdana
;
}
div
,
img
{
margin:0
;
padding:0
;
border
:
0
;
}
ul
,
li
{
list-
style
-
type
:
none
;
margin:0
;
padding:0
;
float:left
;
}
#
info
{
margin-left:auto
;
margin-right:auto
;
width
:
760px
;
text
-
align
:
left
;
}
#new
{
margin-top:-12px
;
position: absolute
;
margin-left:-12px
;
}
#nav
{
height
:
30px
;
width
:
610px
;
margin-left:auto
;
margin-right:auto
;
}
#nav
li
{
margin-left:1px
;
height
:
30px
;
}
#nav
li
a
{
display:block
;
float:left
;
text
-
decoration:none
;
background
-
image: url
(
http:
/
/
www
.
zishu
.
cn
/
attachments
/
month_0605
/
r200652134132
.
gif
)
;
background
-
repeat: no-repeat
;
display:block
;
background
-
position:left top
;
}
#nav
a
span
{
cursor:hand
;
color
:
#
000
;
background
-
image: url
(
http:
/
/
www
.
zishu
.
cn
/
attachments
/
month_0605
/
v200652134115
.
gif
)
;
background
-
repeat: no-repeat
;
display:block
;
background
-
position: right top
;
padding:7px 10px 6px 10px
;
float:left
;
}
#nav
li
a
:
active
,
#
nav
li
a
:
hover
{
margin-top:0px
;
}
#nav
li
a
:
active
span
,
#
nav
li
a
:
hover
span
{
padding:10px 10px 6px 10px
;
margin-top:0px
;
display:block
;
color
:
#
FFF
;
}
#zishu01
a
:
link
,
#
zishu01
a
:
visited
{
background
-
position: 0px -27px
;
}
#zishu01
a
:
link
span
,
#
zishu01
a
:
visited
span
{
background
-
position:right -27px
;
padding:10px 10px 6px 10px
;
margin-top:0
;
color
:
#
FFF
;
font
-
weight:bold
;
}
#zishu02
a
,
#
zishu03
a
,
#
zishu04
a
,
#
zishu05
a
,
#
zishu06
a
,
#
zishu07
a
,
#
zishu08
a
,
#
zishu09
a
,
#
zishu10
a
,
#
zishu11
a
{
margin-top:3px
;
}
#zishu02
a
:
active
,
#
zishu02
a
:
hover
{
background
-
position: 0px -57px
;
}
#zishu02
a
:
active
span
,
#
zishu02
a
:
hover
span
{
background
-
position:right -57px
;
}
#zishu03
a
:
active
,
#
zishu03
a
:
hover
{
background
-
position: 0px -87px
;
}
#zishu03
a
:
active
span
,
#
zishu03
a
:
hover
span
{
background
-
position:right -87px
;
}
#zishu04
a
:
active
,
#
zishu04
a
:
hover
{
background
-
position: 0px -117px
;
}
#zishu04
a
:
active
span
,
#
zishu04
a
:
hover
span
{
background
-
position:right -117px
;
}
#zishu05
a
:
active
,
#
zishu05
a
:
hover
{
background
-
position: 0px -147px
;
}
#zishu05
a
:
active
span
,
#
zishu05
a
:
hover
span
{
background
-
position:right -147px
;
}
#zishu06
a
:
active
,
#
zishu06
a
:
hover
{
background
-
position: 0px -177px
;
}
#zishu06
a
:
active
span
,
#
zishu06
a
:
hover
span
{
background
-
position:right -177px
;
}
#zishu07
a
:
active
,
#
zishu07
a
:
hover
{
background
-
position: 0px -207px
;
}
#zishu07
a
:
active
span
,
#
zishu07
a
:
hover
span
{
background
-
position:right -207px
;
}
#zishu08
a
:
active
,
#
zishu08
a
:
hover
{
background
-
position: 0px -237px
;
}
#zishu08
a
:
active
span
,
#
zishu08
a
:
hover
span
{
background
-
position:right -237px
;
}
#zishu09
a
:
active
,
#
zishu09
a
:
hover
{
background
-
position: 0px -267px
;
}
#zishu09
a
:
active
span
,
#
zishu09
a
:
hover
span
{
background
-
position:right -267px
;
}
#zishu10
a
:
active
,
#
zishu10
a
:
hover
{
background
-
position: 0px -297px
;
}
#zishu10
a
:
active
span
,
#
zishu10
a
:
hover
span
{
background
-
position:right -297px
;
}
#zishu11
a
:
link
span
,
#
zishu11
a
:
visited
span
{
color
:
#
FF6600
;
}
#zishu11
a
:
active
,
#
zishu11
a
:
hover
{
background
-
position: 0px -327px
;
}
#zishu11
a
:
active
span
,
#
zishu11
a
:
hover
span
{
background
-
position:right -327px
;
}
#
menu
{
width
:
760px
;
height
:
26px
;
background
:
#
FF9900
;
}
#r1
{
border
-
top: 0px
;
border
-
bottom: 0px
;
border
-
left:3px solid #fff
;
border
-
right:3px solid #fff
;
height
:
1px
;
overflow:hidden
;
}
#r2
{
border
-
top: 0px
;
border
-
bottom: 0px
;
border
-
left:2px solid #fff
;
border
-
right:2px solid #fff
;
height
:
1px
;
overflow:hidden
;
}
#r3
{
border
-
top: 0px
;
border
-
bottom: 0px
;
border
-
left:1px solid #fff
;
border
-
right:1px solid #fff
;
height
:
1px
;
overflow:hidden
;
}
<
/
style
>
以下是内容部分:
<
div
id
=
"info"
>
<
div
id
=
"nav"
>
<
ul
>
<
li
id
=
"zishu01"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
首页
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu02"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
数码通讯
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu03"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
女人
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu04"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
男人
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu05"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
家居
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu06"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
书籍音像
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu07"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
运动
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu08"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
游戏
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu09"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
宠物
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu10"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
香港街
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu11"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
淘宝商城
<
/
span
>
<
/
a
>
<
/
li
>
<
li
>
<
div
id
=
"new"
>
<
img
src
=
"/down/upload/2007-5-18/200751814274451352.gif"
alt
=
"新加栏目"
/
>
<
/
div
>
<
/
li
>
<
/
ul
>
<
/
div
>
<
div
id
=
"menu"
>
<
div
id
=
"r1"
>
<
/
div
>
<
div
id
=
"r2"
>
<
/
div
>
<
div
id
=
"r3"
>
<
/
div
>
<
div
>
<
/
div
>
<
/
div
>
<
/
div
>
<
p
>
仿淘宝网首页导航条效果 转载请注明出处 子鼠 www
.
zishu
.
cn 2006-05-21 凌晨03:05分
<
/
p
>
作者:
php
时间:
2007-12-17 17:17
<
!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"
/
>
<
title
>
TAO BAO TEST 2
<
/
title
>
<
style
>
/
*
www
.
zishu
.
cn 子鼠
*
/
body
{
font
-
size
:
12px
;
text
-
align
:
center
;
margin-top:30px
;
font
-
family:Verdana
;
}
div
,
img
{
margin:0
;
padding:0
;
border
:
0
;
}
ul
,
li
{
list-
style
-
type
:
none
;
margin:0
;
padding:0
;
float:left
;
}
#
info
{
margin-left:auto
;
margin-right:auto
;
width
:
760px
;
text
-
align
:
left
;
}
#new
{
margin-top:-12px
;
position: absolute
;
margin-left:-12px
;
}
#nav
{
height
:
30px
;
width
:
610px
;
margin-left:auto
;
margin-right:auto
;
}
#nav
li
{
margin-left:1px
;
height
:
30px
;
}
#nav
li
a
{
display:block
;
float:left
;
text
-
decoration:none
;
background
-
image: url
(
http:
/
/
www
.
zishu
.
cn
/
attachments
/
month_0605
/
r200652134132
.
gif
)
;
background
-
repeat: no-repeat
;
display:block
;
background
-
position:left top
;
}
#nav
a
span
{
cursor:hand
;
color
:
#
000
;
background
-
image: url
(
http:
/
/
www
.
zishu
.
cn
/
attachments
/
month_0605
/
v200652134115
.
gif
)
;
background
-
repeat: no-repeat
;
display:block
;
background
-
position: right top
;
padding:7px 10px 6px 10px
;
float:left
;
}
#nav
li
a
:
active
,
#
nav
li
a
:
hover
{
margin-top:0px
;
}
#nav
li
a
:
active
span
,
#
nav
li
a
:
hover
span
{
padding:10px 10px 6px 10px
;
margin-top:0px
;
display:block
;
color
:
#
FFF
;
}
#zishu01
a
:
link
,
#
zishu01
a
:
visited
{
background
-
position: 0px -27px
;
}
#zishu01
a
:
link
span
,
#
zishu01
a
:
visited
span
{
background
-
position:right -27px
;
padding:10px 10px 6px 10px
;
margin-top:0
;
color
:
#
FFF
;
font
-
weight:bold
;
}
#zishu02
a
,
#
zishu03
a
,
#
zishu04
a
,
#
zishu05
a
,
#
zishu06
a
,
#
zishu07
a
,
#
zishu08
a
,
#
zishu09
a
,
#
zishu10
a
,
#
zishu11
a
{
margin-top:3px
;
}
#zishu02
a
:
active
,
#
zishu02
a
:
hover
{
background
-
position: 0px -57px
;
}
#zishu02
a
:
active
span
,
#
zishu02
a
:
hover
span
{
background
-
position:right -57px
;
}
#zishu03
a
:
active
,
#
zishu03
a
:
hover
{
background
-
position: 0px -87px
;
}
#zishu03
a
:
active
span
,
#
zishu03
a
:
hover
span
{
background
-
position:right -87px
;
}
#zishu04
a
:
active
,
#
zishu04
a
:
hover
{
background
-
position: 0px -117px
;
}
#zishu04
a
:
active
span
,
#
zishu04
a
:
hover
span
{
background
-
position:right -117px
;
}
#zishu05
a
:
active
,
#
zishu05
a
:
hover
{
background
-
position: 0px -147px
;
}
#zishu05
a
:
active
span
,
#
zishu05
a
:
hover
span
{
background
-
position:right -147px
;
}
#zishu06
a
:
active
,
#
zishu06
a
:
hover
{
background
-
position: 0px -177px
;
}
#zishu06
a
:
active
span
,
#
zishu06
a
:
hover
span
{
background
-
position:right -177px
;
}
#zishu07
a
:
active
,
#
zishu07
a
:
hover
{
background
-
position: 0px -207px
;
}
#zishu07
a
:
active
span
,
#
zishu07
a
:
hover
span
{
background
-
position:right -207px
;
}
#zishu08
a
:
active
,
#
zishu08
a
:
hover
{
background
-
position: 0px -237px
;
}
#zishu08
a
:
active
span
,
#
zishu08
a
:
hover
span
{
background
-
position:right -237px
;
}
#zishu09
a
:
active
,
#
zishu09
a
:
hover
{
background
-
position: 0px -267px
;
}
#zishu09
a
:
active
span
,
#
zishu09
a
:
hover
span
{
background
-
position:right -267px
;
}
#zishu10
a
:
active
,
#
zishu10
a
:
hover
{
background
-
position: 0px -297px
;
}
#zishu10
a
:
active
span
,
#
zishu10
a
:
hover
span
{
background
-
position:right -297px
;
}
#zishu11
a
:
link
span
,
#
zishu11
a
:
visited
span
{
color
:
#
FF6600
;
}
#zishu11
a
:
active
,
#
zishu11
a
:
hover
{
background
-
position: 0px -327px
;
}
#zishu11
a
:
active
span
,
#
zishu11
a
:
hover
span
{
background
-
position:right -327px
;
}
#
menu
{
width
:
760px
;
height
:
26px
;
background
:
#
FF9900
;
}
#r1
{
border
-
top: 0px
;
border
-
bottom: 0px
;
border
-
left:3px solid #fff
;
border
-
right:3px solid #fff
;
height
:
1px
;
overflow:hidden
;
}
#r2
{
border
-
top: 0px
;
border
-
bottom: 0px
;
border
-
left:2px solid #fff
;
border
-
right:2px solid #fff
;
height
:
1px
;
overflow:hidden
;
}
#r3
{
border
-
top: 0px
;
border
-
bottom: 0px
;
border
-
left:1px solid #fff
;
border
-
right:1px solid #fff
;
height
:
1px
;
overflow:hidden
;
}
<
/
style
>
<
/
head
>
<
body
>
<
div
id
=
"info"
>
<
div
id
=
"nav"
>
<
ul
>
<
li
id
=
"zishu01"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
首页
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu02"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
数码通讯
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu03"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
女人
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu04"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
男人
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu05"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
家居
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu06"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
书籍音像
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu07"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
运动
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu08"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
游戏
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu09"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
宠物
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu10"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
香港街
<
/
span
>
<
/
a
>
<
/
li
>
<
li
id
=
"zishu11"
>
<
a
href
=
"http://www.zishu.cn"
>
<
span
>
淘宝商城
<
/
span
>
<
/
a
>
<
/
li
>
<
li
>
<
div
id
=
"new"
>
<
img
src
=
"/down/upload/2007-5-18/200751814274451352.gif"
alt
=
"新加栏目"
/
>
<
/
div
>
<
/
li
>
<
/
ul
>
<
/
div
>
<
div
id
=
"menu"
>
<
div
id
=
"r1"
>
<
/
div
>
<
div
id
=
"r2"
>
<
/
div
>
<
div
id
=
"r3"
>
<
/
div
>
<
div
>
<
/
div
>
<
/
div
>
<
/
div
>
<
p
>
仿淘宝网首页导航条效果 转载请注明出处 子鼠 www
.
zishu
.
cn 2006-05-21 凌晨03:05分
<
/
p
>
<
/
body
>
<
/
html
>
<
script
language
=
"Javascript"
>
var
now
=
new Date
(
)
;
document
.
write
(
"<img src='http://counter.yesky.com/counter.shtml?CID=54197&AID=-1&refer="
+
escape
(
document
.
referrer
)
+
"&rand="
+
now
.
getTime
(
)
+
"&cur="
+
escape
(
document
.
URL
)
+
"' border='0' alt='' width='0' height='0'>"
)
;
<
/
script
>
<
noscript
>
<
img
src
=
"http://counter.yesky.com/counter.shtml?CID=54197&AID=-1&refer=noscriptcounter&cur=noscriptcounter"
border
=
'0'
width
=
'0'
height
=
'0'
/
>
<
/
noscript
>
作者:
limeng1023
时间:
2012-9-12 13:24
标题:
DIV+CSS容易犯的十个错误
DIV+CSS是网站标准(或称“Web标准”)中常用的术语之一,通常为了说明与HTML网页设计语言中的表格(table)定位方式的区别,因为XHTML网站设计标准中,不再使用表格定位技术,而是采用DIV+CSS的方式实现各种定位。应用应用DIV+CSS编码时很容易犯一些错误。本文列举了一些常见的错误:1. 检查HTML元素是否有拼写错误、是否忘记结束标记即使是老手也经常会弄错div的嵌套关系。可以用dreamweaver的验证功能检查一下有无错误。2. 检查CSS是否正确检查一下有无拼写错误、是否忘记结尾等。可以利用CleanCSS来检查 CSS的拼写错误。CleanCSS本是为CSS减肥的工具,但也能检查出拼写错误。3. 确定错误发生的位置如果错误影响了整体布局,则可以逐个删除div块,直到删除某个div块后显示恢复正常,即可确定错误发生的位置。4. 利用border属性确定出错元素的布局特性使用float属性布局一不小心就会出错。这时为元素添加border属性确定元素边界,错误原因即水落石出。5. float元素的父元素不能指定clear属性MacIE下如果对float的元素的父元素使用clear属性,周围的float元素布局就会混乱。这是MacIE的着名的bug,倘若不知道就会走弯路。6. float元素务必指定width属性很多浏览器在显示未指定width的float元素时会有bug。所以不管float元素的内容如何,一定要为其指定width属性。另外指定元素时尽量使用em而不是px做单位。7. float元素不能指定margin和padding等属性IE在显示指定了margin和padding的float元素时有bug。因此不要对float元素指定margin和padding属性(可以在float元素内部嵌套一个div来设置margin和padding)。也可以使用hack方法为IE指定特别的值。8. float元素的宽度之和要小于100%如果float元素的宽度之和正好是100%,某些古老的浏览器将不能正常显示。因此请保证宽度之和小于99%。9. 是否重设了默认的样式? 某些属性如margin、padding等,不同浏览器会有不同的解释。因此最好在开发前首先将全体的margin、padding设置为0、列表样式设置为none等。10. 是否忘记了写DTD?如果无论怎样调整不同浏览器显示结果还是不一样,那么可以检查一下页面开头是不是忘了写下面这行DTD:
www.csvt.net
本文来源:python爱好者
欢迎光临 编程开发论坛 (http://bbs.lihuasoft.net/)
Powered by Discuz! 6.0.0