父级div的position属性设置为relative后,并没有设置上下左右偏移量,所以还是在原地。实际上可以设置top: 100px看看效果。
同时子元素的position属性设置为absolute,因为父级div具有位置属性,所以可以相对父级元素进行偏移
同时子元素的position属性设置为absolute,因为父级div具有位置属性,所以可以相对父级元素进行偏移
2021-12-07
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>input-placeholder</title>
</head>
<body>
<form>
用户名
<input type="text" name="myname" placeholder="请输入用户名"/>
<br>
密码<input type="password" name="pass" placeholder="请输入密码" />
</form>
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title>input-placeholder</title>
</head>
<body>
<form>
用户名
<input type="text" name="myname" placeholder="请输入用户名"/>
<br>
密码<input type="password" name="pass" placeholder="请输入密码" />
</form>
</body>
</html>
2021-11-03
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>target属性</title>
</head>
<body>
<a href="http://www.baidu.com">百度</a>
<a href="http://www.baidu.com" target="_blank">百度</a>
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title>target属性</title>
</head>
<body>
<a href="http://www.baidu.com">百度</a>
<a href="http://www.baidu.com" target="_blank">百度</a>
</body>
</html>
2021-11-01