小编Jas*_*ang的帖子

使用*universal selector和html有什么区别?

知道这可能是一个荒谬的问题,但使用*universal选择器之间的区别是什么,我知道它适用于页面上的每个元素并仅使用html?

例如:

* {
margin: 0;
padding: 0;
}
Run Code Online (Sandbox Code Playgroud)

html {
margin: 0;
padding: 0;
}
Run Code Online (Sandbox Code Playgroud)

html css

5
推荐指数
1
解决办法
661
查看次数

如果我想让box2在mouseon上将颜色更改为红色,那么使用setAttribute是否正确?

<html>
<head>
<title>Events!</title>

<!-- Loading my CSS -->
<link rel="stylesheet" type="text/css" href="css/styles.css">
</head>
<body>
<div id="box-container">
    <div class="box" id="box1">I'm a box</div>
    <div class="box" id="box2">I'm a box</div>
    <div class="box" id="box3">I'm a box</div>
</div>

<div class="box" id="tricky-box">Tricky box</div>

<button id="secret-button">Super Secret</button>

<input id="secret-input"></input>

<!-- Ignore this stuff till later -->
<br>
<hr>
<hr>
<hr>
<br>

<div class="d1">1
    <div class="d2">2
        <div class="d3">3</div>
    </div>
</div>




<!-- Loading my JS -->
<script src="js/myapp.js" type="text/javascript"></script>
Run Code Online (Sandbox Code Playgroud)

所以我希望box2在mouseon上将颜色改为红色,我想知道这是正确的:

 window.onload = function() {

 box2.onmouseover = function(event){
box2.setAttribute = ("style", …
Run Code Online (Sandbox Code Playgroud)

javascript css dom

1
推荐指数
1
解决办法
44
查看次数

标签 统计

css ×2

dom ×1

html ×1

javascript ×1