CSS+div
发布日期:2021-07-18 18:19:04
浏览次数:2
分类:技术文章
本文共 2215 字,大约阅读时间需要 7 分钟。
通过做三星SmartTV项目对于CSS样式表有了更深刻的理解,运用的更加熟练,比如,利用CSS+DIV对网页做固定宽度且居中操作,做相对定位。对于多个模块的布局应该多用div嵌套,这样做能够使得网页做出来更加稳定,不容易弄得乱起八糟的。对于div内的div它的margin属性都是相对于大比它高一级的div而言的;假如一个div内有好多个div 的话,那么margin属性就是相对于挨着它的div而言的;
下面是我写的一段代码:
<html> <head><title>麦当劳</title> <style type="text/css"> body,html{ margin:0px; padding:0px; text-align:center; } #container{ position:relative; width:1000px; height:540px; background-color:red; text-align:left; background-color: #990000; /*background-image:url('resource/mac/bg.gif');*/ } .mhead { width:1000px; height:88px; } .main { height:452px; width:1000px; } .mmiddle { height:200; width:1000px; text-align:left; } .mbottom { height:200px; width:1000px; text-align:left; } .m1 { width:160px; height:160px; border:solid yellow 1px; margin-left:130px; margin-top:20px; float:left; } .m2 { height:160px; width:160px; border:solid yellow 1px; float:left; margin-top:20px; margin-left:100px; float:left; } .m3 { height:160px; width:160px; border:solid yellow 1px; margin-left:100px; margin-top:20px; float:left; } .m4{ height:160px; width:160px; border:solid yellow 1px; margin-left:130px; margin-top:20px; float:left; } .m5 { height:160px; width:160px; border:solid yellow 1px; margin-left:100px; margin-top:20px; float:left;}
.m6 { height:160px; width:160px; border:solid yellow 1px; margin-left:100px; margin-top:20px; float:left; } .STYLE1 {color: #FFCC33} .STYLE4 { color: #CCFF33; font-size: 14px; } </style> </head> <body> <div id="container"> <div name="mhead" class="mhead" style="background-image:url('mheader.jpg')"></div> <div class="main"> <div class="mmiddle"> <div class="m1" style="background-image:url('m1.jpg')"> </div> <div class="m2" style="background-image:url('m2.jpg')"><img src="m2.jpg"> </div> <div class="m3" style="background-image:url('m3.jpg')"></div> </div> <div class="mbottom"> <div class="m4" style="background-image:url('m4.jpg')"></div> <div class="m5" style="background-image:url('m5.jpg')"></div> <div class="m6"style="background-image:url('m6.jpg')"></div> </div> <table width="984" height="44"> <tr> <td width="840" height="38"><div align="center" class="STYLE1">联系方式:CSDN乐知学院.NET3班重案一组© 版权所有</div></td> </tr> </table> </div> </div> </body> </html>实现效果:
转载地址:https://blog.csdn.net/iteye_3606/article/details/82172931 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
能坚持,总会有不一样的收获!
[***.219.124.196]2024年04月19日 03时42分56秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
vue的一些基础知识点
2019-04-26
webpack错误记录(不定期更新)
2019-04-26
Poj百练 2692:假币问题 (分类:模拟)
2019-04-26
SpringBoot实现一个文件上传服务
2019-04-26
前后分但文件上传与多文件上传,前端实现
2019-04-26
Poj百练 2711:合唱队形 (分类:动态规划)
2019-04-26
SpringBoot自定义banner
2019-04-26
JWT(JSON Web Token)认证小结
2019-04-26
Poj百练 2746:约瑟夫问题 (分类:模拟)
2019-04-26
git知识点梳理
2019-04-26
git中tag标签的用法
2019-04-26
boost::bad_function_call用法的测试程序
2019-04-26
SpringMVC框架学习总结
2019-04-26
boost::function_types::is_function用法的测试程序
2019-04-26