MENU

Trillo笔记

June 30, 2022 • 笔记,css

一个flex布局构建的demo
trillo

设置input中placeholder属性

&::-webkit-input-placeholder {
      font-weight: 100;
      color: var(--color-grey-light-4);
    }

margin在flex中妙用

margin in flex
在一个普通的flex默认布局中,对某element使用margin-right:auto;可实现自动填充最大边距,使得该元素右面的兄弟元素位于最右侧,并且保持自身的盒模型大小不变

好用的currentColor

border-bottom: 0.0625rem solid currentColor;

代表该元素或其父元素颜色,且实时动态更改,无需手写

无限循环动画

&:focus {
    outline: none;
    //TODO
    animation: pulsate 1s infinite;
  }

flex中固定显示比例

&__item {
    flex: 0 0 50%; //TODO
  }

设置grow,shrink为0,basis为比例

last-of-type

.paragraph:not(:last-of-type) {
  margin-bottom: 1.25rem;
}

设置非最后一个同子类的样式,例如两段文字p和底下的其他元素在一起,要设置段落间距,用这个方法。
lastoftype

Demo地址
Trillo

Last Modified: July 1, 2022