当前位置: 首页 > Web前端 > HTML

CSS、HTML、元通用代码

时间:2023-04-02 14:24:03 HTML

CSS1、CSS选择器?引用CSS的方式?CSS优先级是如何计算的?css在线文档①通配符选择器、标签名称选择器、类选择器、ID选择器、后代选择器(含)、子选择器、相邻选择器、兄弟选择器、属性选择器、伪类、伪元素。②内联样式、嵌入样式、link链接样式、import导入样式。③!import"inlinestyle"ID"class"标签名称选择器,越具体的选择器级别越高。2.css盒模型box-sizing定义了浏览器应该如何计算一个元素的总宽和高;标准模式下的content-box盒子模型,元素的宽高不包括padding和border,其总宽高等于集合的宽高和border和padding的总和;border-box是怪异模式下的盒模型,元素的宽高包括padding和border,即使有border和padding也不会改变元素的实际宽度。盒模型从内到外内容有四个属性,padding,border,Margin3,link链接类型,import导入类型linkweightisgreater比@importlink是一个html标签,可以通过JS操作DOM来改变样式;@import是css提供的,只能加载。CSSlink在页面加载时同时加载,@import在页面加载完成后加载。无样式,页面闪烁后网页样式4.边框实现三角形三角形指向右边,然后在左边边框设置实线solid,其他边框设置transparent透明。使用边框让三角形水平和垂直居中8.CSSsticky-footerlayouttop

bottom--pageno超过则固定在底部,超过则正常显示
1.实现一个最大的正方形//第一种不能显示子元素div{width:100%;heigth:0;padding-bottom:100%}//第二种伪元素+padding-bottom+absolute。father{width:100%;position:relative}.father::after{content:'';display:block;padding-bottom:100%}.son{position:absolute;width:100%;height:100%}2.一行水平居中,多行左对齐。father{text-align:center}.son{display:inline-block;text-align:left}3.实现两列布局左侧固定,右边的自适应布局使用浮动。左侧元素的宽度固定,右侧元素的margin-left设置为floatleft设置为固定宽度,右侧会自动填满父元素或右侧元素的margin-left将更改为溢出:隐藏/自动;这样右边会触发BFC使用绝对定位,而父元素会被设置为相对定位。左侧元素是绝对定位的并且具有固定的宽度。右侧元素的margin-left值设置为左侧元素的宽度。或者右边元素绝对定位,left是左边元素的宽度值4,css3实现三列布局,左右固定,中间自适应使用flex布局display:flex;左右元素flex00200px;中间元素flex:1采用浮动实现,父元素固定宽高,左框向左浮动,右框向右浮动,宽高固定,中间框自适应。将中间自适应框的html标签放在最后,使用绝对定位来实现。为父框设置相对定位,为两边的框设置绝对定位,并根据父框进行偏移。左边框为left0,右边框为right0,中间框为margin0200px5,BFC理解为块级格式化上下文,独立的渲染区域,相当于一个容器,里面的元素容器不会影响外部元素的布局,外部元素也不会影响内部元素的布局激活方式。浮动元素floatleft/right定位元素positionabsolute/fixeddisplayflex/inline-block/table-celloverflowhidden/auto/scroll不可见功能解决margin重叠问题,默认相邻元素margin会重叠解决ofheightcollapse:子元素设置为float后,父元素的高度会塌陷,即父元素的高度变为0。把父元素变成BFC,设置overflowhidden,创建自适应两列布局,左边设置float:left,右边设置overflow:hidden。这样BFC在右边触发,BFC的区域不会和浮动元素重叠。left{width:100px;height:200px;background:red;float:left}.right{height:300px;background:#00f;overflow:hidden
6.实现左右布局,每个div使用display:table-cell,div的父元素使用display:flex7。清除浮动元素的下一个兄弟元素{clear:both;}浮动元素的父元素{display:block;zoom:1;overflow:hidden;}浮动元素的父元素::after{display:block;clear:both;visibility:hidden;height:0;content:'';}设置浮动元素会破坏文档流结构,影响元素布局。给当前元素设置clear:both会将相邻元素中具有浮动属性的元素视为不浮动,以抵消对自身的影响HTML1,关闭首字母大写(HTML)2。伪类:activeinvalidbodyclass=""onmousemove=""ontouchstart=""3.H5页面模板标题meta1,设置页面的编码(HTML)2,禁止手机缩放(HTML)"2.删除默认的苹果工具栏和菜单栏,默认全屏(HTML)3.启用或禁用自动识别电话号码、电子邮件地址、地址(HTML)4、文档兼容模式——IE以最高级的模式呈现文档(HTML)5.顶部状态栏背景颜色(HTML)6.页面关键字和描述--搜索引擎使用(HTML)7.Winphone系统如何去除点击input标签时产生的半透明灰色背景?CSS1。取消输入搜索关闭(CSS)input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none;//这里只是去掉默认的小×}::-webkit-search-cancel-button{display:none;}input[type="search"]{-webkit-appearance:none;}7.重写占位符样式input[type=search]::-webkit-input-placeholder{color:blue;}2.禁止选择和复制文本(CSS)-webkit-touch-callout:无;-webkit-用户选择:无;-khtml-用户选择:无;-moz-用户选择:无;-ms-用户选择:无;用户选择:无;[contenteditable=true],input,textarea{-webkit-touch-callout:auto!important;-webkit-用户选择:自动!重要;-khtml-用户选择:自动!重要;-moz-用户选择:自动!重要;-ms-user-select:自动!重要;user-select:auto!important}3.输入和按钮消除触摸阴影(CSS)-webkit-tap-highlight-color:transparent;4、取消按钮默认样式-webkit-tap-highlight-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;outline:0;5。改变webkit表单输入框占位符的颜色值input::-webkit-input-placeholder{color:#AAAAAA;}input:focus::-webkit-input-placeholder{color:#EEEEEE;}6.媒体查询(CSS)(@mediascreenand(max-width:330px)and(min-width:311px){}7.CSStemplate@charset"UTF-8";a,body,button,div,form,h1,h2,h3,h4,h5,h6,header,html,input,nav,p,section,table,textarea,dl,dt,ol,ul,li{margin:0;padding:0;outline:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}body,html{width:100%;font-family:Helvetica,Arial,'MicrosoftYaHei',sans-serif;background-color:#f2f2f2;font-size:100px;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}a,button,input,textarea{-webkit-tap-highlight-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;text-decoration:none;border:0}dl,dt,ol,ul,li{list-style:none}[contenteditable=true],input,textarea{-webkit-touch-callout:auto!important;-webkit-user-select:auto!important;-khtml-user-select:auto!important;-moz-user-select:auto!important;-ms-user-select:auto!important;user-select:auto!important}.ellipsis{overflow:hidden;-ms-text-overflow:ellipsis;white-space:nowrap;text-overflow:ellipsis}.ellipsis-clamp-3{overflow:hidden;-ms-text-overflow:ellipsis;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}otherautocapitalize首字妈妈自动大写自动更正自动改正自动完成自动输入$(this).data('hello');$(this).attr('data-hello')display:flex;flex-direction:column;justify-content:center地址簿字母导航样式e.currentTarget.dataset.xxx和e.target.dataset.xxxe.currentTarget。options.selectedIndex和e.currentTarget.valuehttp://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js.clearfix:after,.clearfix:before{content:"";display:table;}.clearfix:after{clear:both;}常用连接CSS在线API--1meta标签扩展