首页 > 其他分享 >12.02

12.02

时间:2022-12-02 20:11:31浏览次数:34  
标签:index 定位 标签 100px 12.02 border left

今日内容

1.边框

2.display

3.盒子模型

4.浮动

5.溢出

6.定位

7.Z-index

8.简易博客页面搭建

1.边框

/*border-left-width: 5px;*/
/*border-left-style: dotted;*/
/*border-left-color: #0000ff;*/
  简写
/*border-left: 3px solid black;*/
    
border: 10px solid orange;
    
画圆
border-radius: 50%;

2.display

用于控制HTML元素的显示效果
行内标签是无法设置长宽,只有块儿级可以设置
display:none  彻彻底底的隐藏标签(页面上不会显示,也不会保留标签的位置)
visibility: hidden  隐藏的不彻底

3.盒子模型

我们可以将标签看成是一个快递盒
1.快递盒里面的实际物体		  content(内容)
2.物体与内部盒子墙的距离	     padding(内边距、内填充)
3.快递盒的厚度				   border(边框)
4.快递盒之间的距离				 margin(外边距)

/*    !*padding: 20px; 上下左右*!*/
/*    !*padding: 20px 40px;  上下   左右*!*/
/*    !*padding: 10px 20px 30px;上  左右  下*!*/
/*    !*padding: 10px 20px 30px 40px;上 右 下 左*!*/
margin与padding用法一致
针对标签的嵌套 水平方向可以居中
margin: 0 auto;

4.浮动

浮动就是用来做页面布局的
浮动的现象
	float:left\right   
浮动带来的影响:浮动的元素是脱离正常文档流的,会造成父标签塌陷
如何解决浮动的影响
	clear
解决浮动带来的影响终极方法
	先提前写好样式类
    	.clearfix:after {
            content: '';
            display: block;
            clear: both;
        }
	谁塌陷了,就给谁添加clearfix样式类就可以了 
浏览器会优先展示文本内容(如果被挡住)

5.溢出

overflow(水平和垂直均设置)
overflow-x(设置水平方向)
overflow-y(设置垂直方向)
div {
            height: 150px;
            width: 150px;
            border: 5px solid greenyellow;
            border-radius: 50%;
            overflow: hidden;
        }
div img {
            max-width: 100%;
        }

6.定位

标签在默认情况下都是无法通过定位的参数来移动
针对定位有四种状态
	1.static静态(标签默认的状态 无法定位移动)
 	2.relative相对定位(基于标签原来的位置)
 	3.absolute绝对定位(基于某个定位过的父标签做定位)
	4.fixed固定定位(基于浏览器窗口固定不动)
        .c1 {
            background-color: red;
            height: 100px;
            width: 100px;
            position: relative;
        }
        .c2 {
            background-color: greenyellow;
            height: 100px;
            width: 200px;
            position: absolute;
            top: 100px;
            left: 100px;
        }
		.c1 {
            border: 5px solid black;
            height: 100px;
            width: 100px;
            position: fixed;
            right: 100px;
            bottom: 200px;
        }

7.Z-index

z-index 值表示谁压着谁,数值大的压盖住数值小的,
只有定位了的元素,才能有z-index,也就是说,不管相对定位,绝对定位,固定定位,都可以使用z-index,而浮动元素不能使用z-index
z-index值没有单位,就是一个正整数,默认的z-index值为0如果大家都没有z-index值,或者z-index值一样,那么谁写在HTML后面,谁在上面压着别人,定位了元素,永远压住没有定位的元素。
从父现象:父亲怂了,儿子再牛逼也没用

body {
            margin: 0;
        }
.cover {
            background-color: rgba(127,127,127,0.5);
            position: fixed;
            left: 0;
            bottom: 0;
            right: 0;
            top: 0;
            z-index: 100;
        }
.modal {
            height: 200px;
            width: 400px;
            background-color: white;
            z-index: 101;
            position: fixed;
            left: 50%;
            top: 50%;
            margin-left: -200px;
            margin-top: -100px;
        }

8.简易博客页面搭建

1.分析页面结构
	利用布局标签div和span搭建架子
2.先编写网页骨架
	HTML
3.再编写CSS
4.最后编写JS

标签:index,定位,标签,100px,12.02,border,left
From: https://www.cnblogs.com/yueq43/p/16945514.html

相关文章