常用html样式--2

作者: 前端丶米店 | 来源:发表于2017-12-13 15:57 被阅读15次

1:灰色背景

#hidebg { 
  position:fixed;left:0px;top:0px;
  background-color:#000;
  width:100%;  /*宽度设置为100%,这样才能使隐藏背景层覆盖原页面*/
  filter:alpha(opacity=60);  /*设置透明度为60%*/
  opacity:0.6;  /*非IE浏览器下设置透明度为60%*/
  display:none; /*http://www.jb51.net */
  z-index:90;
  height: 100%;
}

2:删除线效果

text-decoration:line-through;

3:jquery寻找父元素下的其他子元素

$('.div_1').click(function(){
    $(this).parent().find('.div_2').show();
});

4:渐入渐出

$(".div_1").slideToggle();

5:绝对定位
绝对定位的元素的位置相对于最近的已定位祖先元素。

<style>
    .son{position:absolute;top:100px;left:10px;}
</style>
<body>
  <div class="grandfather">
      <div class="father">
          <div class="son"></div>
      </div>
  </div>
</body>

上面的例子中 class=‘son’ 想使用绝对定位,但是它的父级 class="father" 和它父级的父级 class="grandfather"都没有定位,所以 class=‘son’ 的定位是相对于body的。

<style>
    .father{position:relative;margin-top:500px;}
    .son{position:absolute;top:100px;left:10px;}
</style>
<body>
  <div class="grandfather">
      <div class="father">
          <div class="son"></div>
      </div>
  </div>
</body>

上面的例子中 class=‘son’ 想使用绝对定位,但是它的父级 class="father" 设置了一个position:relative,所以 class=‘son’ 的定位是相对于 class="father" 的。

6、黑色透明背景

    background: #000;
    opacity: 0.42;

7、border渐变

border-image: -webkit-linear-gradient( red, blue) 30 30;
border-image: -moz-linear-gradient( red, blue) 30 30;
border-image: linear-gradient( red, blue) 30 30;

8丶多行溢出显示省略号

display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;

相关文章

  • 常用html样式--2

    1:灰色背景 2:删除线效果 3:jquery寻找父元素下的其他子元素 4:渐入渐出 5:绝对定位绝对定位的元素的...

  • doy01

    A今天学到了什么 1、html和css是什么 2、了解html标签 3、常用的html标签 4、常用的css样式 ...

  • day02

    知识要点梳理 1.常用的HTML标签 2.CSS常用选择器 3.CSS样式:修饰HTML网页 4.样式重置 5.水...

  • 知识点一

    1、了解html标签 2、常用的html标签 3、常用的css样式 4、css常用选择器 5、盒子模型 6.3ma...

  • day01

    今天学了什么 1.什么是html , 什么是css 2.常用的html标签 3.常用的css样式 border ...

  • day01

    A 今天学到了什么 html和css是什么 2.了解html标签 3.常用的html标签 4.常用的css样式 5...

  • HTML 5 属性使用方法;学习笔记(一)

    HTML 5 属性使用方法 1、常用标签属性: 2、通用属性: HTML 5 格式化及使用 HTML 5 样式、链...

  • 2018-06-19

    A.今天学到什么 1.什么是HTML和CSS 2.常用的HTML标签 3.常用的CSS样式 3.1CSS基本语法 ...

  • day01

    今天开始用vs code 编写前端网页 1.什么是HTML和CSS 2.常用的HTML标签 3.常用的CSS样式 ...

  • day01

    A.今天学了什么 1.html是什么;css是什么. 2.常用的html标签有. 3常用的css样式 4.css常...

网友评论

    本文标题:常用html样式--2

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