<html> ---- position
position 固定的属性,是全局的。和DIV层次无关。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <div style="background-color: aqua">标记1</div> <div style="background-color: brown ;position: fixed; bottom: 0;right: 0" >标记2</div> </body> </html>
结果如下:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <div style="background-color: aqua ;height: 100px"> 标记1 <div style="background-color: brown ;" >标记2</div> </div> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <div style="background-color: aqua ;height: 100px"> 标记1 <div style="background-color: brown ;position: fixed;right: 0;bottom: 0;" >标记2</div> </div> </body> </html>