三个块状元素怎么破???
怎么安排中间块状元素居中???
怎么安排中间块状元素居中???
2018-05-20
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> father{ width: 500px; height: 500px; background: #000; } .son1{ height: 100px; background: green; } .son2{ height: 200px; background: yellow; } .son3{ height: 100px; background: red; } .son2 h1{ text-align: center; line-height: 200px; margin: 0; } </style> </head> <body> <div class="father"> <div class="son1"></div> <div class="son2"> <h1>中间块的元素居中</h1> </div> <div class="son3"></div> </div> </body> </html>
举报