css中背景的应用

  浏览器默认的字体大小是 font-size:16px; 谷歌最小的是10px 其他浏览器是12px

  通配符选择器 *   “*”的意思是代表所有的标签

  回到正题

  background   背景

  他的几个属性  背景颜色  background-color:red;    (IE9以下给body设置background-color:不起作用需要用到bgcolor)

         背景图片  background-image:url("路径“);

         图片平铺   1.平铺 (浏览器默认)

              2.不平埔   background-repeat:no-repeat;                                                                                                                                                                                                 3.平铺一整张背景 background-size: 100% 100;  横向x    纵向y

              4.平铺整行 background-repeat:repeat-x;

              5.平铺整列  background-repeat:repeat-y;

        背景位置  background-position    (注意背景位置也叫坐标轴位置  : 向右为正 向下为正

          background-position:100px 100px;     意思是向右100像素  向下100像素   (具体数字)

                 位置值种类 具体的数字  百分比  或英文单词

          background-position: 50% 50%;        向右百分之五十  向下百分之五十

          background-position:top left;   意思是向上  向左        top    left     right     bottom    center

                                 上      左  右  底部   中间

      也可以进行简写  background:red url("路径") no-repeat 100px 100px;

                  颜色    图片          平铺         位置

      注意不是所有图片都可以   如   图片大小就不行

      边框

       边框粗细   border-2px;      边框大小2像素

      边框颜色   border-color:blue;

      边框样式   border-style:solid;     (实线)             bashed(虚线)

      边框简写   border:blue 1px dashed;    第三个必须是样式    

      边框圆角   border-radius: 50% 50%;   这是个圆形   小于或大于百分之五十  会有直线  变成圆角矩形   

      (后面的值必须是百分比)

      

         

原文地址:https://www.cnblogs.com/shangjun6/p/9636669.html