CSS相关

作者: Alfred的记录本 | 来源:发表于2019-04-02 16:29 被阅读0次

::after ::before

rem

多个class属性的优先级

http://blog.csdn.net/u011320646/article/details/18152857

float

flex

  • display 制定为flex布局
display: -webkit-flex; /* Safari */
display: flex;
display: inline-flex;
  • flex-direction属性决定主轴的方向

  • flex-wrap属性定义,如果一条轴线排不下,如何换行

  • flex-flow

  • justify-content属性定义了项目在主轴上(横轴)的对齐方式

  • align-items在交叉轴(纵轴)上如何对齐

  • align-content

  • 项目的属性

display

overflow:overflow 属性规定当内容溢出元素框时发生的事情。

position

  • fixed:元素的位置相对于浏览器窗口是固定位置。即使窗口是滚动的它也不会移动.
  • sticky:粘性定位的元素是依赖于用户的滚动,在 position:relative 与 position:fixed 定位之间切换。
  • relative
  • absolute
  • static

max-height, 最大高度,如果设置了height则不起作用,height代表固定高度,

top margin-top 等的区别。

1、top、bottom、left、right是绝对定位,必须设置position为absolute。 margin一系列设置是相对定位。注意:如果用top等,而position未设置为absolute,那设置是不起作用的。
2、top这些在绝对定位的前提下,这个绝对定位,是相对body 或者 position:relative的父级元素的绝对定位。margin的相对定位,是指相对相邻元素的定位。

pading,会扩大控件的大小,但是如果是按钮,扩大的区域不在响应范围内

<button className="hover-button">
        <a href="#" style={{color:'#000'}}>Vue</a>
</button>
.hover-button {
    padding: 15px 32px;
}

后代选择器

后代选择器有一个易被忽视的方面,即两个元素之间的层次间隔可以是无限的。后代选择器用一个或者多个空格。

h1 em {color:red;}
//important 会显示红色
<h1>This is a <em>important</em> heading</h1>
//important 不会变色
<p>This is a <em>important</em> paragraph.</p>

类选择器

  • 多类选择器
.important {font-weight:bold;}
.warning {font-style:italic;}
.important.warning {background:silver;}
//同时具备font-weight font-style background三个样式
<p class="important warning">This paragraph is a very important warning.</p>

相邻兄弟选择器

h1 + p {margin-top:50px;}

子元素选择器

如果您不希望选择任意的后代元素,而是希望缩小范围,只选择某个元素的子元素,请使用子元素选择器

h1 > strong {color:red;}
//两个very 均会变成红色
<h1>This is <strong>very</strong> <strong>very</strong> important.</h1>
//very不会变色
<h1>This is <em>really <strong>very</strong></em> important.</h1>

相关文章

  • css相关

    position: relative:对象遵循常规流,并且参照自身在常规流中的位置通过投票,bottom,righ...

  • css相关

    外边距叠加问题当两个外边距相遇时(中间没有border、padding等)凡是未形成块级格式化上下文(BFC)的盒...

  • css 相关

    1.CSS 强制不换行,文字溢出显示省略号~ css一共就三句话: { white-space: nowrap; ...

  • CSS相关

    ::after ::before rem 多个class属性的优先级 http://blog.csdn.net/...

  • Css相关

    color: ××× !important; 提高优先级,行内样式优先级最高。 DIV设置浮动后无法撑开外部DIV...

  • CSS相关

    1.两种盒模型 盒模型: 内容(content)、填充(padding)、边界(margin)、 边框(borde...

  • CSS相关

    居中 块元素水平居中 行内元素水平居中 模拟表格 实现水平居中display:table ( ) | table-...

  • CSS相关

    flex:flex-grow flex-shrink flex-basis flex-grow 默认为0,即如果...

  • css相关

    网页验证码是干嘛的,是为了解决什么安全问题区分用户是计算机还是人的公共全自动程序。可以防止恶意破解密码、刷票、论坛...

  • 2018前端面试总结

    前端目录 HTML相关 CSS相关 JAVASCRIPT相关 DOM相关 HTTP相关 VUE相关 算法相关 网络...

网友评论

      本文标题:CSS相关

      本文链接:https://www.haomeiwen.com/subject/cvcbmxtx.html