hover用于a标签_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:46:59
Original
1249 people have browsed it

本帖最后由 u012721633 于 2013-11-04 18:10:32 编辑

<head> <style>	ul li a:hover{	 background-color: red;	} </style></head><ul> <li><a>文字</a></li></ul>
Copy after login


这样只有 文字 悬停时会变红 但是我要前面的小圆点也变红 有没有办法?
实际工作中背景是个图片 把背景图片向左移也行 就是要整个 li 都在背景中
但hover只对a有效 ,如果在li外面包一个,好像会背景图片有文字的地方是白的 而且整个li会向右移
不想用脚本 ,有没有办法?


回复讨论(解决方案)





无标题文档







<!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" /><title>无标题文档</title></head><style>ul li{	background:url(你那小点的图片) no-repeat left center; padding-left:10px; height:24px; line-height:24px;}ul li a:hover{	background-color: red;}</style><body><ul>	<li><a>文字</a></li></ul></body></html>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template