请老师检查作业,另外按钮在盒子里如何居中
来源:4-10 自由编程
暴力大王
2021-11-14 10:40:29
请老师检查作业,另外按钮在盒子里如何居中
相关代码:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> *{ margin:0; padding:0; } img{ display: block; } .center{ width: 100%; height: 760px; background: lightblue; } .center div{ width: 25%; height: 760px; float:left; } .center div img{ width: 100%; height: 380px; } .center div .main { width:100%; height: 380px; } .center div .main h2{ font-size: 24px; color:#fff; margin-top:20px; margin-left:20px; } .center div .main dl dt{ font-size:16px; color:#fff; margin-top:30px; margin-left:20px; } .center div .main dl dd{ font-size: 14px; color:gray; margin-top:30px; margin-left:20px; } .center div .main .bnt{ width: 130px; height: 40px; background: #000; margin-top:30px; margin-left:137px; } .center div .main .bnt button{ background: none; border:none; color:#fff; font-size:20px; line-height: 40px; margin-left:17px; } </style> </head> <body> <div class="center"> <div> <img src="images/b1.jpg" alt=""> <div class="main"> <h2>library</h2> <dl> <dt>Lorem Ipsum is dummy text of the printing and typesetting industry</dt> <dd>Lorem Ipsum has been the industry's standard dymmy text ever since the 1500s,when an unkown printer took a galley of type and scrambled it to make a type specimen book </dd> </dl> <div class="bnt"> <button>EXPLORE</button> </div> </div> </div> <div> <div class="main"> <h2>library</h2> <dl> <dt>Lorem Ipsum is dummy text of the printing and typesetting industry</dt> <dd>Lorem Ipsum has been the industry's standard dymmy text ever since the 1500s,when an unkown printer took a galley of type and scrambled it to make a type specimen book </dd> </dl> <div class="bnt"> <button>EXPLORE</button> </div> </div> <img src="images/b2.jpg" alt=""> </div> <div> <img src="images/b3.jpg" alt=""> <div class="main"> <h2>library</h2> <dl> <dt>Lorem Ipsum is dummy text of the printing and typesetting industry</dt> <dd>Lorem Ipsum has been the industry's standard dymmy text ever since the 1500s,when an unkown printer took a galley of type and scrambled it to make a type specimen book </dd> </dl> <div class="bnt"> <button>EXPLORE</button> </div> </div> </div> <div> <div class="main"> <h2>library</h2> <dl> <dt>Lorem Ipsum is dummy text of the printing and typesetting industry</dt> <dd>Lorem Ipsum has been the industry's standard dymmy text ever since the 1500s,when an unkown printer took a galley of type and scrambled it to make a type specimen book </dd> </dl> <div class="bnt"> <button>EXPLORE</button> </div> </div> <img src="images/b4.jpg" alt=""> </div> </div> </body> </html>
1回答
樱桃小胖子
2021-11-14
同学你好,关于同学的问题解答如下
1、代码中的布局及样式需要优化,具体如下:
2、按钮的剧中效果设置如下(要按照上面的代码设置后,再设置这里的代码才能实现居中效果哦!):
祝学习愉快!
相似问题