2018-04-21 记录一些用到的CSS样式【留下了不学无术的泪水

  • 圆角边框

CSS3 border-radius 属性

div{
    border:2px solid;
    border-radius:25px;
}

效果


image.png
  • 只要四个角的边框

CSS background 属性

    background: linear-gradient(to left, #FF3399, #FF3399) left top no-repeat, 
                linear-gradient(to bottom, #FF3399, #FF3399) left top no-repeat, 
                linear-gradient(to left, #FF3399, #FF3399) right top no-repeat,
                linear-gradient(to bottom, #FF3399, #FF3399) right top no-repeat, 
                linear-gradient(to left, #FF3399, #FF3399) left bottom no-repeat,
                linear-gradient(to bottom, #FF3399, #FF3399) left bottom no-repeat,
                linear-gradient(to left, #FF3399, #FF3399) right bottom no-repeat,
                linear-gradient(to left, #FF3399, #FF3399) right bottom no-repeat;
    background-size: 1px 20px, 20px 1px, 1px 20px, 20px 1px;

效果


image.png

可以用背景图片实现吧。。。可能吧。。。

  • 超过固定宽度的文本内容显示...

    text-overflow:ellipsis;
    overflow:hidden;
    white-space:nowrap;
    width:300px;
  }

效果


image.png
  • 阴影边框

box-shadow: -10px 0 0 green; //左边阴影
box-shadow: 10px  0 0 yellow; //右边阴影
box-shadow: 0 -10px 0 blue; //顶部阴影
box-shadow: 0 10px 0 red; //底部阴影

效果


image.png
  • 遮罩层

background: rgba(34, 34, 34, 0.7); 可以实现遮罩层 父元素透明 子元素不透明

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 各种纯css图标 CSS3可以实现很多漂亮的图形,我收集了32种图形,在下面列出。直接用CSS3画出这些图形,要比...
    剑残阅读 9,700评论 0 8
  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    wzhiq896阅读 1,805评论 0 2
  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    love2013阅读 2,338评论 0 11
  • 1、属性选择器:id选择器 # 通过id 来选择类名选择器 . 通过类名来选择属性选择器 ...
    Yuann阅读 1,657评论 0 7