滚动条展示 overflow-x: hidden;/*是否对内容的左/右边缘进行裁剪*/overflow-y: hidden;/*是否对内容的上/下边缘进行裁剪*/overflow:scroll;/*左右滚动*/overflow: hidden;/*截取*/overflow: auto;/*自动*/
显示与隐藏可以用display/* display: none; *//* display: block; *//* display: inline-block; */visibility显示与隐藏visibility:hidden;/*隐藏*/visibility: visible;/*显示*/需要注意的是display是不占位隐藏,visibility是占位隐藏;

 <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>11种常用css样式学习大结局滚动条与显示隐藏</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
font: 14px/1.5em "Microsoft YaHei";
}
/*滚动条常见样式展示*/
div.box{
width: 300px;
height: 200px;
word-spacing: 5px;
margin: 0 auto;
border: 2px inset red;
overflow-x: hidden;/*是否对内容的左/右边缘进行裁剪*/
overflow-y: hidden;/*是否对内容的上/下边缘进行裁剪*/
overflow:scroll;/*左右滚动*/
overflow: hidden;/*截取*/
overflow: auto;/*自动*/
}
div{
/*display显示隐藏*/
/* display: none; */
/* display: block; */
/* display: inline-block; */ /* visibility显示与隐藏 */
visibility:hidden;
visibility: visible;
}
</style>
</head>
<body>
<div class="box">
<p style="width: 400px;">塞纳河畔左岸的咖啡 我手一杯品尝你的美 留下唇印的嘴 花店玫瑰名字写错谁 告白气球风吹到对街 微笑在天上飞 你说你有点难追 想让我知难而退 礼物不需挑最贵 只要香榭的落叶 喔营造浪漫的约会 不害怕搞砸一切 拥有你就拥有全世界セーヌ川の左岸にコーヒーを1杯持っています。あなたの美しさを味わい、リッププリントを残します。フラワーショップの名前が間違っています。 シャンパンの葉がロマンチックなデートを演出する限り、最も高価なものを選ぶ必要があります。すべてを台無しにすることを恐れないでください。あなたには世界があります。</p><!--设置里面内容宽度不然底部滚动不出现-->
</div>
<span>I have a cup of coffee on the left bank of the Seine. I taste your beauty and leave a lip print. The name of the flower shop rose is wrong. Who confessed that the balloon was blowing across the street and smiling in the sky. Need to pick the most expensive as long as the leaves of the Champs create a romantic date. Don't be afraid to mess everything up. You have the world.</span>
</body>
</html>

知识面扩展阅读:CSS3 overflow-x 属性  display显示时要注意块和行,为什么说display是不占位隐藏,visibility是占位隐藏

 <!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>为什么说display是不占位隐藏,visibility是占位隐藏</title>
<style>
*{
font-family: 微软雅黑;
margin:0px;
} .line1{
display:none;
/* visibility:hidden; */
} </style>
<script src="jquery.min.js"></script>
</head>
<body>
<span class='line1'>塞纳河畔左岸的咖啡 我手一杯品尝你的美 留下唇印的嘴 花店玫瑰名字写错谁 告白气球风吹到对街 微笑在天上飞 你说你有点难追 想让我知难而退 礼物不需挑最贵 只要香榭的落叶 喔营造浪漫的约会 不害怕搞砸一切 拥有你就拥有全世界</span>
<span class='line2'>セーヌ川の左岸にコーヒーを1杯持っています。あなたの美しさを味わい、リッププリントを残します。フラワーショップの名前が間違っています。 シャンパンの葉がロマンチックなデートを演出する限り、最も高価なものを選ぶ必要があります。すべてを台無しにすることを恐れないでください。あなたには世界があります。</span>
<span class='line3'>I have a cup of coffee on the left bank of the Seine. I taste your beauty and leave a lip print. The name of the flower shop rose is wrong. Who confessed that the balloon was blowing across the street and smiling in the sky. Need to pick the most expensive as long as the leaves of the Champs create a romantic date. Don't be afraid to mess everything up. You have the world.</span>
<button>显示1</button>
<button>显示2</button>
<button>显示3</button>
</body>
<script>
// $('button').eq(0).click(function(){
// $('.line1').css({'display':'block'});
// })
// display显示时要注意块和行
// $('button').eq(0).click(function(){
// $('.line1').css({'display':'inline'});
// })
// visibility显示和隐藏
$('button').eq(0).click(function(){
$('.line1').css({'visibility':'visible'});
})
</script>
</html>

11种常用css样式学习大结局滚动条与显示隐藏的更多相关文章

  1. 11种常用css样式之表格和定位样式学习

    table表格中border-collapse: collapse;/*表格边框是否合并*/border-spacing: 10px;/*表格边框之间的距离*/定位详情可以阅读position属性值4 ...

  2. 11种常用css样式之鼠标、列表和尺寸样式学习

    鼠标cursor常见样式crosshair;/*十字形状*/cursor:pointer;/*小手形状*/cursor:wait;/*等待形状*/cursor:text;/*默认 文本形状*/curs ...

  3. 11种常用css样式之border学习

    边框border通常简写为"border:1px solid red;"但其实一个完整的border边框其实是由1.border-width/*边框宽度*/,2.border-st ...

  4. 11种常用css样式之background学习

    background如何简写?如何在背景图像不变的情况下,依旧实现页面文字滚动,为之奈何?别担心,快用background-attachment: fixed;/*固定定位*/常用的backgroun ...

  5. 11种常用css样式之开篇文本字体学习

    常见css样式:1.字体与颜色2.背景属性3.文本属性4.边框属性5.鼠标光标属性6.列表样式7.定位属性8.内外边距9.浮动和清除浮动10.滚动条11.显示和隐藏 文本:1.letter-spaci ...

  6. 获取jQuery对象的第N个DOM元素 && table常用css样式

    获取jQuery对象的第N个DOM元素 1.$(selector).get(N-1) 2.$(selector)[N-1] 注意:.index()方法返回的是一个数,相当于C#中的IndexOf() ...

  7. Day 31:CSS选择器、常用CSS样式、盒子模型

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  8. html之CSS样式学习笔记

    本文内容: 字体样式 文本样式 背景样式 尺寸样式 盒子模型 边框样式 边距样式 浮动布局 定位布局 [CSS3]伸缩布局 标签显示方式 列表样式 [CSS3]过渡样式 [CSS3]变换样式之2D变形 ...

  9. 常用css样式(布局)

    兼容css3新属性 在css3中,我们可以使用prefixfree.min.js这个插件来自动为css3的相关属性加上兼容浏览器属性,使我们不用为每个css3新属性再加上属性(需要用到大量css3的项 ...

随机推荐

  1. 调试 ambari-server 总结

    刚开始debug ambari-server的时候,很多逻辑都是第一次接触.其中有很多知识点还是记录一下的好,做个备忘.这些知识点对于自定义api的开发还是很有作用的. 1. api的子href的最后 ...

  2. 个人任务day7

    今日计划: 整合程序,排除错误. 昨日成果: 写注册界面.

  3. 无法解析导入javax.mail

    本文链接:https://blog.csdn.net/aaqian1/article/details/89357195下载地址: http://www.oracle.com/technetwork/j ...

  4. RChain的一键形式化验证:关于RCast 33 – LADL话题的讨论摘要

    作者/Atticbee 在这一集,Greg和RChain的研究人员Isaac,Christian讨论了TLA(Temporal Logic of Actions)和RChain的LADL(Logic ...

  5. TCP/IP、TCP、UDP、Socket知识汇总

    带你了解TCP/IP,UDP,Socket之间关系 https://blog.csdn.net/chaoshenzhaoxichao/article/details/79785318 主要知识点: T ...

  6. tf.keras遇见的坑:Output tensors to a Model must be the output of a TensorFlow `Layer`

    经过网上查找,找到了问题所在:在使用keras编程模式是,中间插入了tf.reshape()方法便遇到此问题. 解决办法:对于遇到相同问题的任何人,可以使用keras的Lambda层来包装张量流操作, ...

  7. XGBoost原理学习总结

    XGBoost原理学习总结 前言 ​ XGBoost是一个上限提别高的机器学习算法,和Adaboost.GBDT等都属于Boosting类集成算法.虽然现在深度学习算法大行其道,但很多数据量往往没有太 ...

  8. ios--->ios == 和 isEqual的用法区别

    ios == 和 isEqual的用法区别 首先要理解指针和指针值的却别 存放变量地址的变量我们称之为"指针变量",简单的说变量p中存储的是变量a的地址,那么p就可以称为是指针变量 ...

  9. 下载 安装MYsql 服务器

    摘自 https://blog.csdn.net/youxianzide/article/details/85319106 https://www.2cto.com/database/201805/7 ...

  10. 关于Windows Server 服务器 安装tomcat部署Java Web 项母

    抄至 http://blog.csdn.net/cx0330/article/details/68957914 我遇到的问题是:不知道怎么配置,感觉在服务器上部署一个web项目,应该是很高大上,步骤应 ...