浅谈HTML(css基础样式)

下面小编就为大家带来一篇浅谈HTML(css基础样式)。小编觉得挺不错的, 现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧

solid 边框加粗
border:5px 设置边像素
display:inline-block 横着显示块状的
line-height:40px 字体上下居中
text-align:center 字体左右居中
margin-right:20px 调整外界边框

CSS Code复制内容到剪贴板
  1. <body style="margin: 0px">
  2. <div style="width: 80px;height: 40px;border: 5px salmon solid;
  3. display: inline-block; line-height: 40px; text-align: center;
  4. margin-right:20px">呵呵
  • <div style="width: 80px; height: 40px;border: 5px slateblue solid;
  • display: inline-block;line-height: 40px; text-align: center;
  • margin-right: 60px">导航

www.0133.cn

2. margin;边距,顺序是上 ,右, 下, 左 可以负数

CSS Code复制内容到剪贴板
  1. <div style="width: 200px;height: 200px;border: 5px salmon solid;">
  2. <div style="width: 100px;height: 100px;border: 5px seagreen solid;
  3. margin: 20px 30px 20px 50px">

www.0133.cn

2.1 padding:内边距 顺序一样,上,左,下,右,从内边缘开始长胖

CSS Code复制内容到剪贴板
  1. <div style="width: 200px;height: 200px;border: 5px salmon solid;">
  2. <div style="width: 100px;height: 100px;border: 5px seagreen solid;
  3. padding: 20px 30px 20px 50px">

www.0133.cn

3.margin-top 设置元素的上外边距,如果有多个边距则选择最大值

CSS Code复制内容到剪贴板
  1. <div style="width: 200px;height: 200px;background-color: #FF0000;
  2. margin-top: 100px">
  3. <div style="width: 100px;height: 100px;background-color: aqua;
  4. margin-top: 30px">

www.0133.cn

浮动调整

1.无浮动效果

CSS Code复制内容到剪贴板
  1. <div style="width: 200px; height: 200px;border: 10px darkmagenta solid">无与伦比
  • <div style="width: 300px;height: 300px;background-color: chartreuse">的美丽

  • www.0133.cn

    2.有浮动的效果

    CSS Code复制内容到剪贴板
    1. <div style="width: 200px; height: 200px;border: 10px salmon solid;float:left">无与伦比
  • <div style="width: 300px; height: 300px;background-color: seashell">美妙绝伦

  • www.0133.cn

    3.清除浮动

    CSS Code复制内容到剪贴板
    1. <div style="width: 200px;height: 200px;border: 10px darkgoldenrod solid;float: left">无与伦比
  • <div style="clear: left;width: 300px;height: 300px;background-color: chartreuse;">美妙绝伦
  • <!--clear:left 清除浮动,只可以清除左浮动
  • clear:both 清除所有浮动
  • 输出的结果是,和没写浮动是一样的
  • 以上就是小编为大家带来的浅谈HTML(css基础样式)全部内容了,希望大家多多支持脚本之家~

    原文地址:http://www.cnblogs.com/pythonxiaohu/p/5614514.html

以上就是浅谈HTML(css基础样式)的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » CSS 教程