首页 > 其他分享 >css边框盒子模型浮动定位

css边框盒子模型浮动定位

时间:2022-12-02 21:25:08浏览次数:37  
标签:浮动 定位 盒子 标签 100px 边框 border css left

今日内容概要

  • 边框
  • 盒子模型
  • 浮动
  • 定位
  • 补充说明
  • 简易博客页面搭建

今日内容详细

边框

border-left-widh: 5px;
border-left-style: dotted;
border-left-color: #0000ff;

border-left: 3px solid black;

border: 10px solid orange;

画圆
border-radius: 50%;

display

"""
行内标签是无法设置长度 只有块儿级可以设置
"""
display:none  彻彻底底的隐藏表情(页面上不会显示 也不会保留标签的位置)
visibility: hidden  隐藏的不彻底

盒子模型

我们可以将标签看成是一个盒子(快递盒)

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;

浮动

浮动就是用来做页面布局的

浮动现象
	float:left\right

浮动带来的影响
	浮动的元素是脱离正常文档刘的 会造成父标签塌陷

如何解决浮动的影响
	clear
    
解决浮动带来的影响终极方法
	先提前写好样式类
    	.clearfix:after {
            content: '';
            display: block;
            clear: both;
        }
     谁塌陷了 就给谁添加clearfix样式类就可以了
    
ps:浏览器会优先展示文本内容(如果被挡住)    

溢出

div {
    height:150px;
    width:150px;
    border:5px solid greenyellow;
    border-radius:50%;
    overflow:hidden;
}
div img {
    max-width:100%;
}

定位

标签在默认情况下都是无法通过定位的参数来移动
针对定位有四种状态
	1.static静态(标签默认的状态 无法定位移动)
	2.relative相对定位(基于标签原来的位置)
	3.absolute绝对定位(基于某个定位过的父标签做定位)
	4.fixed固定定位(基于浏览器窗口固定不动)
		.ci {
            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;
        }

z-index

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:400;
    background-color:white;
    z-index:101;
    position:fixed;
    left:50%;
    top:50%;
    margin-left:-200px;
    margin-top:-100px;
}

标签:浮动,定位,盒子,标签,100px,边框,border,css,left
From: https://www.cnblogs.com/DragonY/p/16945638.html

相关文章

  • 边框属性,display属性,css盒子模型,浮动、溢出、定位、z-index属性和建议博客页面搭建
    边框关键字borderborder-left-width:5px;border-left-style:dotted;#边框线的样式border-left-colorborder-left:3pxsolidblack;#上面的简写border:10p......
  • CSS实现3D旋转相册效果
    效果预览前置知识透视,perspective3D位移,translate3d(x,y,z)3D旋转,rotate3d(x,y,z)3D呈现,transform-styleCSS3动画,@keyframesbox-reflect、linear-gra......
  • 前端 css属性设置
    边框/*1.边框样式*/none无边框dotted点状虚线边框dashed矩形虚线边框solid实线边框/*2.统一设置边框属性*/#i1{......
  • 12月2日内容总结——边框属性,display属性,css盒子模型,浮动、溢出、定位、z-index属性和
    目录一、边框二、display属性三、CSS盒子模型概念margin外边距padding内填充四、浮动float三种取值clear清除浮动五、溢出overflow溢出属性六、定位staticrelative(相对定位......
  • css(2)
    边框/*border-left-width:5px;*//*border-left-style:dotted;*//*border-left-color:#0000ff;*//*border-left:3pxsolidblack;*/border:10pxsolid......
  • CSS边框,定位 ,浮动,溢出 盒子模型
    CSS(2)边框标签都有边框,我们可以通过css来调整边框。#左边框border-left-width:3px;边框粗细可以配颜色color样式style粗细width上下左右只需要在border......
  • 前端之css
    目录边框display盒子模型浮动溢出定位z-index简易博客页面搭建边框border-left-width:5px;border-left-style:dotted;dotted-定义点线边框border-left-color:#0......
  • css关系选择器
    父子关系div>span{}祖先后代divspan{}兄弟关系div+span{}标签选择器divspan{}id选择器#span{}class选择器.div{}......
  • CSS3 filter(滤镜) 属性使用整理
    一、CSS3filter(滤镜) 1.定义filter属性定义了元素(通常是<img>)的可视效果(例如:模糊与饱和度)。默认值:none继承:no动画支持:是。详细可查阅 CSS动画......
  • 前端CSS学习(二)
    目录边框画圆小例子displaydisplay属性盒子模型浮动溢出overflow溢出属性圆形头像示例定位fixedz-index顶部导航栏代码展示简易博客页面搭建边框<head><metacharse......