display&position display:block 将子对象作为块对象呈递。很多内联样式的效果,需要用到display。 #photo a img{border:3px solid #FF6600; } #photo a:hover {display:block;} /**若不加此句,则内联对象img的样式不会显示**/ #photo a:hover img{ border:2px solid blue;} [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]position 内容的尺寸根据布局尺寸确定对象的尺寸。 #text{position:relative;} /**若没有,则内联对象不显示。若为block,会作为块级元素而使虚线过长。posigion时,长度由text的内容决定。**/ #text span{width:200px; height:20px;border-bottom: 1px dashed #000000 ; } 示例文字 下划线样式 [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]