Home >Web Front-end >HTML Tutorial >css sliding door technology_html/css_WEB-ITnose
The double sliding door effect is still relatively common, and it is actually easy to understand:
The two doors are like the effect formed by the overlap of two block-level elements. Look at a piece of code as follows:
#Mydoor ul li a:hover{ color:#fff; //设置背景 黑色 background: url(hover.gif); //设置背景 图片,图片周边应为透明,这样才能把背景衬托出来 }You can see the changes on the left side as follows
/**将连接a下的内容变为块级;给右边一个宽度*/#Mydoor ul li a b{ display:block; //设置为块元素 padding:0 14px 0 0; //设置右边距为14像素 } /**经过后右上定位*/ #Mydoor ul li a:hover b{ color:#fff; //设置背景 黑色 background: url(hover.gif) no-repeat right top; //设置背景图片,右对齐 }
The effect after editing