css 已设置的属性怎么去掉

html-css021

css 已设置的属性怎么去掉,第1张

每个css属性都有自己的默认属性值,比如字体粗细的默认值是font-weight:normal,如果设置了粗体又想去掉,就设置成默认值就行;如果值是数值,比如padding:100px可以设置成0回到默认padding:0

需要准备的材料分别有:电脑、浏览器、html编辑器。

1、首先,打开html编辑器,新建html文件,例如:index.html。

2、在index.html中的<script>标签中,输入js代码:

$('td').click(function () {

$('td').css('font-weight', 'normal')

$(this).css('font-weight', 'bold')

})

3、浏览器运行index.html页面,点击“我是A”,此时字体会变粗。

4、再点击“我是B”,此时“我是A”的字体粗度恢复正常,“我是B”的字体变粗。

用选择器选到你的二级菜单,因为不知道你的标签和属性,所以如果你一级菜单已经用CSS设定属性和值,那么在选择你的二级菜单甚至三级菜单的时候,选择器很重要,如果你上面的代码是一级菜单的CSS,

假设你的二级菜单的

class="menu-list1",

假设你的三级菜单的

class="menu-list2",

12345.skin-box-bd .menu-list .menu-list1, .skin-box-bd .menu-list .menu-list1:hover, .skin-box-bd .menu-list .menu-list1 .menu-list2, .skin-box-bd .menu-list .menu-list1 .menu-list2:hover { font: normal color: gray list-style-type: none}

不过以上CSS的选择器真是太恐怖了,最好给菜单设定一个

id

值。