首页 > 其他分享 >css小知识点

css小知识点

时间:2024-05-30 12:05:05浏览次数:26  
标签:知识点 space auto align flex webkit 100 css

canvas知识点总结:
  • 判断画笔是否存在
connt ctx=canvas.getContext("2d")
  • 画矩形,方式一 api画 方式二路径 rect(x,y,w,h) fill()
//样式
fillStyle("red")//实心填充
strokeStyle("#ccc")//空心 
lineCap="butt"//线端
lineWidth=10//线宽

fillRect(x,y,w,h)
strokeRect()

clearRect()
  • 画圆
arc(100,100,50,0,360*Math.PI/180,true)
moveTo()
arcTo(x1,y1,x2,y2)
  • 路径
beginPath()//清空路径容器
moveTo(50,50)
lineTo(50,100)
lineTo(100,100)
closePath()//stroke需要手动闭合
stroke()//
fill()//自带闭合路径,不需要closePath()
  • 作用域
// save 保存样式,restore弹出样式
save()
//样式
todo
beginPath()
//路径
todo
restore()
web端尺寸位置api:
offsetTop
offsetLeft

scrollTop
scrollLeft

innerHeight//视口的高度
innerWidth //

cliectX
clientY
flex布局
  • 父元素属性:
display:flex; //开启弹性布局

flex-flow:row cente; //缩写
flex-wrap:nowarp; //nowrap(不换行) | wrap(向下换) | 
flex_direction:row; //排列方向row | row-reverse | column | column-reverse;
justify-content:flex_start; //主轴对齐方式 flex-start | flex-end | center | space-between | space-around;
wrap-reverse(向上换);
align-items: stretch; // 交叉轴对齐方式flex-start | flex-end | center | baseline | stretch;
align-content:flex-start; //多根交叉轴线的对齐方式 | flex-end | center | space-between | space-around | stretch;
  • Flex布局子元素属性
flex:0 1 auto;//缩写flex-grow, flex-shrink 和 flex-basis,默认值为0 1 auto。后两个属性可选
flex-grow:1;
flex-shrink:1;//定义了空间不足时自身缩小比例,默认为1自动缩小,0不缩小
flex-basis:auto;//默认值为auto,即自身的本来大小
order:1;//定义自身排列顺序。数值越小,越靠前,
align-self:auto; //可覆盖align-items属性。默认值为auto,表示继承父元素的align-items属性,如果没有父元素,则等同于stretch。
超出文本,显示省略号
    overflow:hidden;
    space-white:nowarp;
    text-overflow:ellipsis
    
    
    display: -webkit-box;  /*  display: -webkit-box; 必须结合的属性 ,将对象作为弹性伸缩盒子模型显示  */
    -webkit-box-orient: vertical; /*  -webkit-box-orient 必须结合的属性 ,设置或检索伸缩盒对象的子元素的排列方式  */
    -webkit-line-clamp: 3; /*  -webkit-line-clamp用来限制在一个块元素显示的文本的行数 */
清除浮动:
  • 1.父级设置宽高
  • 2.父级设置overflower:hidden;
  • 3.当前元素设置浮动。float:left
清除浮动以后脱离文档流,高度塌陷,解决方法清除浮动
.clear-fix {
        *zoom: 1
 }
.clear-fix::after {
    content: '';
    visibility: hidden;
    display: block;
    height: 0;
    clear: both;
 }
input背景透明:
background:transparent !important;//最高优先级
background:rgb(0,0,0,0.3);//黑色背景半透明
响应式
        @media screen and (min-width:960px){
            html{
                font-size: 20px;
            }
        }
        @media screen and (max-width: 500px) {
            html{
                font-size: 10px;
            }
        }
        @media screen and (max-width: 320px) {
            html{
                font-size: 5px;
            }
        }
      transform: translateX(-1px)translateY(2px);
栅格布局神器

https://grid.layoutit.com/

标签:知识点,space,auto,align,flex,webkit,100,css
From: https://www.cnblogs.com/qiyuemh/p/18222060

相关文章

  • JS小知识点
    js是单线程的所有的同步任务都是按顺序依次执行的,前面的执行完了之后才会执行后面的任务../上级目录./当前文件夹目录说出==和===的区别普通相等:==在比较类型不相同的情况下,会将运算元先转成Number的值,再进行比较(即会进行隐式转换)严格不等:===在进行比......
  • 第二十五章CSS中的技巧(导航栏、下拉列表)
    1.CSS精灵1.什么是CSS精灵英文叫法 CSSsprites,通常被解释为“CSS图像拼合”或“CSS贴图定位”;其实就是把网页中一些背景图片整合到一张图片文件中,再利用css“background-image”,“background-repeat”,“background-position”的组合进行背景定位,background-position用数......
  • 第二十六章HTML与CSS书写规范
    1.HTML书写规范1.文档类型声明及编码统一为html5声明类型。编码统一为utf-8。2.页面tdkTDK是一个缩写,其中“T”表示为网页定义标题,“D”表示为网页定义描述description,“K”表示为搜索引擎定义关键词keywords。1、<title>标题:只强调重点即可,尽量把重要的关键词放在前面......
  • css23 CSS Links, Cursors
    https://www.w3schools.com/css/css_link.asp CSSLinks  WithCSS,linkscanbestyledinmanydifferentways.StylingLinksLinkscanbestyledwithanyCSSproperty(e.g.color,font-family,background,etc.).Examplea{  color:hotpink;}&l......
  • css22 CSS Icons
    https://www.w3schools.com/css/css_icons.aspIconscaneasilybeaddedtoyourHTMLpage,byusinganiconlibrary.  HowToAddIconsThesimplestwaytoaddanicontoyourHTMLpage,iswithaniconlibrary,suchasFontAwesome.Addthenameofth......
  • css21 CSS Fonts
    https://www.w3schools.com/css/css_font.asp Choosingtherightfontforyourwebsiteisimportant!FontSelectionisImportantChoosingtherightfonthasahugeimpactonhowthereadersexperienceawebsite.Therightfontcancreateastrongidentity......
  • css20 CSS Text
    https://www.w3schools.com/css/css_text.aspCSShasalotofpropertiesforformattingtext. <!DOCTYPEhtml><html><head><style>div{border:1pxsolidgray;padding:8px;}h1{text-align:center;text-transform:u......
  • css17 CSS Height, Width
    https://www.w3schools.com/css/css_dimension.aspTheCSSheightandwidthpropertiesareusedtosettheheightandwidthofanelement.TheCSSmax-widthpropertyisusedtosetthemaximumwidthofanelement.Thiselementhasaheightof50pixelsand......
  • css18 CSS Box Model
    https://www.w3schools.com/css/css_boxmodel.aspAllHTMLelementscanbeconsideredasboxes.TheCSSBoxModelInCSS,theterm"boxmodel"isusedwhentalkingaboutdesignandlayout.TheCSSboxmodelisessentiallyaboxthatwrapsarounde......
  • css15 CSS Margins
    https://www.w3schools.com/css/css_margin.aspMarginsareusedtocreatespacearoundelements,outsideofanydefinedborders. <!DOCTYPEhtml><html><head><style>div{margin:70px;border:1pxsolid#4CAF50;}</styl......