麻烦老师可以看一下我的代码还有什么可优化的地方吗?谢谢!
来源:2-7 编程练习
奇异果子chia
2020-04-16 23:14:34
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>CSS布局</title> <style type="text/css"> /*此处写代码*/ *{ margin:0; padding:0; } .title{ padding-top:100px; color: black; font-size: 45px; font-weight: bolder; text-align: center; font-family: "宋体"; } .con{ float: left; padding:10px; font-weight: bold; font-size: 20px; } .container{ position: absolute; margin-left: -431px; left: 50%; } </style> </head> <body> <!-- 此处写代码 --> <div class="title">ENJOY THE LIFE</div> <div class="container"> <div class="con"> <img src="http://climg.mukewang.com/58f829090001a4b504260240.jpg"/> <div class="word"> Life is like a book, just read more and more <br>refined, more write more carefully. When read,<br> mind open, all things have been indifferent to<br> heart. Life is the precipitaion. </div> </div> <div class="con"> <img src="http://climg.mukewang.com/58f8290f0001558804260240.jpg"/> <div class="word"> Life is like a book, just read more and more <br>refined, more write more carefully. When read,<br> mind open, all things have been indifferent to<br> heart. Life is the precipitaion. </div> </div> </div> </body> </html>
1回答
好帮手慕码
2020-04-17
同学你好,建议优化如下:
(1)给con设置宽度:
(2)整体没有居中,修改如下:
如果我的回答帮到了你,欢迎采纳,祝学习愉快~
相似问题
回答 1