css div滚动_如何使用CSS创建可垂直滚动的div?

css div滚动

Introduction:

介绍:

Dealing with divs has become a regularity and divs are used for many purposes like to structure our code and to segregate our various sections of codes. Besides, we are also aware of many properties that we can imply or amend over divs to make our website or web page responsive but there are times we tend to forget some of the methods or properties which could be used while developing a website or web page and sometimes these properties also make our work easy, as sometimes they happen to reduce the number of codes. So one must always keep learning about various properties to explore new ways for developing a website or web page. With that note in mind, we must move forward with our topic.

处理div已经成为一种常态,并且div用于许多目的,例如构造我们的代码和分离我们的代码的各个部分。 此外,我们也意识到我们可以暗示或修改div以使我们的网站或网页具有响应性的许多属性,但有时我们会忘记开发网站或网页时可以使用的某些方法或属性有时这些属性也使我们的工作变得容易,因为有时它们恰好减少了代码数量。 因此,必须始终了解各种属性,以探索开发网站或网页的新方法。 牢记这一点,我们必须推进我们的主题。

The task:

任务:

To create a vertically scrollable div is not a challenging task as it seems but as mentioned earlier, one must keep learning new methods or properties, besides there might come a time when you will require a vertically scrollable div and at that time you would know the exact answer to your problem, all thanks to this article. Well, now that we have established an understanding of the importance of this discussion, so without much further adieu, let us move on with the task.

创建一个垂直可滚动的div看起来并不是一项艰巨的任务,但是正如前面提到的,人们必须不断学习新的方法或属性,此外,有时候可能需要垂直可滚动的div,那时您会知道对您问题的确切答案,这一切都归功于本文。 好了,既然我们已经对这次讨论的重要性有了一个了解,那么就不用多说了,让我们继续进行下去。

Property used:

使用的属性:

As mentioned earlier, creating a vertically scrollable div is not tough, some things here and there and you will catch up to it in no time. For creating a vertically scrollable div for your website or web page you have to make use of a property known as overflow property. You might as well be familiar with this property and its behavior. So, by using overflow one can create a vertically scrollable div. As we all know that Overflow property takes up a certain amount of values such as overflow-x: hidden and overflow-y: auto. By making use of these values you will be able to create vertical and horizontal scroll bars.

如前所述,创建一个垂直可滚动的div并不困难,到处都是,您很快就会赶上它。 为了为您的网站或网页创建一个垂直滚动的div,您必须使用一个被称为溢出属性的属性 。 您可能还熟悉此属性及其行为。 因此,通过使用溢出可以创建一个垂直滚动的div。 众所周知,Overflow属性会占用一定数量的值,例如overflow-x:hidden和overflow-y:auto。 通过使用这些值,您将能够创建垂直和水平滚动条。

Solution:

解:

To create a vertical scroll bar use x and y-axis and you should set the overflow-x property as hidden and overflow-y property as auto. By doing so the horizontal scroll bar property would hide automatically and only vertical scroll bar would be displayed. Therefore, the scroll bar created in the process would be vertically.

创建垂直滚动条,请使用x和y轴,您应将overflow-x属性设置为hidden ,将overflow-y属性设置为auto 。 这样,水平滚动条属性将自动隐藏,并且仅显示垂直滚动条。 因此,在该过程中创建的滚动条将是垂直的。

Syntax:

句法:

    Element{
overflow-x:hidden;
overflow-y:auto;
}

Example:

例:

<!DOCTYPE html>
<html>
<head>
<style>
div {
background-color: #006969;
color: #fff;
width: 400px;
height: 100px;
overflow-x: hidden;
overflow-y: auto;
text-align: justify;
}
</style>
</head>
<body>
<h1>create a vertically scrollable div</h1>
<div>
This is IncludeHelp. This is IncludeHelp. This is IncludeHelp.
This is IncludeHelp. This is IncludeHelp. This is IncludeHelp.
This is IncludeHelp. This is IncludeHelp. This is IncludeHelp.
This is IncludeHelp. This is IncludeHelp. This is IncludeHelp.
This is IncludeHelp. This is IncludeHelp. This is IncludeHelp.
This is IncludeHelp. This is IncludeHelp. This is IncludeHelp.
This is IncludeHelp. This is IncludeHelp. This is IncludeHelp.
This is IncludeHelp. This is IncludeHelp. This is IncludeHelp.
This is IncludeHelp. This is IncludeHelp. This is IncludeHelp.
This is IncludeHelp. This is IncludeHelp. This is IncludeHelp.
This is IncludeHelp. This is IncludeHelp. This is IncludeHelp.
This is IncludeHelp. This is IncludeHelp. This is IncludeHelp.
This is IncludeHelp. This is IncludeHelp. This is IncludeHelp.
</div>
</body>
</html>

CSS | create a vertically scrollable div Example

In the above example, the div is vertically scrollable.

在上面的示例中, div可垂直滚动

Try yourself:

尝试一下:

Pretty easy right? All we had to do was make use of a very familiar property known as Overflow property and set its x-axis value to hidden and y-axis value auto and bam! A vertical scrollable div emerged as a result. So go ahead and try this new learned method on your own by taking the help of examples. And if you think you need some assistance our writers and experts are available for you at https://ask.includehelp.com/.

很容易吧? 我们要做的就是利用一个非常熟悉的属性,即Ove​​rflow属性,并将其x轴值设置为hidden和y轴值auto和bam! 结果出现了一个垂直的可滚动div。 因此,请继续通过示例来尝试这种新学到的方法。 如果您认为需要帮助,请访问https://ask.includehelp.com/,我们的作家和专家将为您提供帮助。

翻译自: https://www.includehelp.com/code-snippets/how-to-create-a-vertically-scrollable-div.aspx

css div滚动

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/542175.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Linux中磁盘分区的管理

1. 本地存储设备的识别 fdisk -l真实存在的设备cat /proc/partitions系统识别的设备blkid系统可使用的设备df系统正在挂载的设备 真实存在的设备不一定可识别&#xff0c;识别到的的设备不一定可使用 2. 设备的挂载和卸载 1&#xff09;设备名称 /dev/xdx …

游戏架构之二(转)

棋牌类游戏常用架构&#xff1a; 我从事过4年的棋牌类游戏开发&#xff0c;使用过的架构大致如上&#xff0c;各模块解释如下。 LoginServer&#xff1a; 登陆服务器&#xff0c;主要负责player 的登陆请求&#xff0c;验证player的合法性&#xff0c;为合法的player分配sessio…

对lvm介绍

1. 什么是LVM LVM是 Logical Volume Manager&#xff08;逻辑卷管理&#xff09;的简写&#xff0c;它是Linux环境下对磁盘分区进行管理的一种机制&#xff0c;用户在无需停机的情况下可以方便地调整各个分区大小。 lvm中的一些常见符号及意义 pv物理卷被lv命令处理过的物理分…

linux中系统修复

1. 引导文件丢失 &#xff08;1&#xff09;引导文件所在路径 /boot/grub2/grub.cfg 需提前知道根目录所在分区和内核版本 uname -r 查询内核版本命令 模拟问题 rm -fr /boot/grub2/grub.cfg 一不小心把这玩意儿给删了&#xff0c;还reboot了 完了以后机子开不了了就这情况 …

dw相对路径怎么改_密云ETL怎么收费

密云ETL怎么收费&#xff0c;派客动力&#xff0c;公司依托自有产品&#xff0c;整合行业资源&#xff0c;构建先进的数据管理解决方案&#xff0c;解决企业和组织的核心数据问题以及被影响的业务挑战。这种工具我都使用过&#xff0c;优点有&#xff1a;图形界面&#xff0c;开…

python 自动化之路 day 08_2 网络编程

本节内容 Socket介绍Socket参数介绍基本Socket实例Socket实现多连接处理通过Socket实现简单SSH通过Socket实现文件传送作业&#xff1a;开发一个支持多用户在线的FTP程序1. Socket介绍 概念 A network socket is an endpoint of a connection across a computer network. Today…

Elasticsearch过滤与聚合的先后顺序java实现

2019独角兽企业重金招聘Python工程师标准>>> 一、Elasticsearch的聚合 ES的聚合相当于关系型数据库里面的group by&#xff0c;例如查找在性别字段男女人数的多少并且按照人数的多少进行排序&#xff0c;在使用MySQL的时候&#xff0c;可以使用如下的句子 select se…

js手机号中间四位_11位手机号码隐藏中间四位数,学会Substitute函数一键搞定!...

相信许多朋友都有见过手机号码被*号隐藏中间四位数的情况。许多地方为了保护个人信息&#xff0c;都会将手机号的中间四位数用星号代替。如上图所示&#xff0c;我们需要将原来的手机号码&#xff0c;通过*号的方式变为隐藏后的加密模式。下面我们就来学习一下如何利用substitu…

python 整数最大_Python程序使用floor()方法查找最大整数

python 整数最大The greatest integer function is a function (real numbers function) to itself that is defined as follows: it sends any real number to the largest integer that is less than or equal to it. 最大整数函数是一个对其自身定义的函数(实数函数)&#x…

selinux对ftp的影响

1.啥是selinux 安全增强型Linux&#xff08;Security-Enhanced Linux&#xff09;简称selinux&#xff0c;它是一个Linux内核模块&#xff0c;也是Linux的一个安全子系统。 selinux的状态&#xff1a; Enforcing:强制模式&#xff0c;在selinux运作时&#xff0c;已经开始限制d…

ES6的class方法基本用法

为什么80%的码农都做不了架构师&#xff1f;>>> 在ES5中我们通常通过构造函数&#xff0c;定义并生成新对象。 例如: function Point(name,age){this.namename;this.ageage;}Point.prototype{Who:function(){return "My name is "this.name",My age…

celery的中文_celery异步任务框架

目录Celery一、官方二、Celery异步任务框架Celery架构图消息中间件任务执行单元任务结果存储三、使用场景四、Celery的安装配置五、两种celery任务结构&#xff1a;提倡用包管理&#xff0c;结构更清晰七、Celery执行异步任务包架构封装八、基本使用celery.py 基本配置tasks.py…

关于linux mv指令机制

最近在mv文件的时候&#xff0c;操作失误将生产服务器一个1TB的文件夹mv到了/opt/test目录&#xff0c;因为最后/opt/目录被沾满所以1TB的文件夹没有迁移过来&#xff0c;写入了30GB数据到了/opt/test目录&#xff0c;因为系统分区被沾满&#xff0c;所以把test目录给删除了。 …

数据库的管理

1. 数据库的简介 定义&#xff1a;数据库&#xff08;Database&#xff09;就是一种按数据结构来组织&#xff0c;存储和管理数据的仓库&#xff0c;其中包含数据挖掘&#xff0c;大数据信息的推送。 mariadb数据库管理系统是mysql的一个分支&#xff0c;主要由开源社区在维护&…

C#中的Dictionary字典类介绍(转载)

C#中的Dictionary字典类介绍 关键字&#xff1a;C# Dictionary 字典 作者&#xff1a;txw1958原文&#xff1a;http://www.cnblogs.com/txw1958/archive/2012/11/07/csharp-dictionary.html 说明 必须包含名空间System.Collection.Generic Dictionary里面的每一个元素都…

高速缓存dns

1. DNS&#xff1a; Domain Name System&#xff0c;域名系统。 万维网上作为域名和IP地址相互映射的一个分布式数据库&#xff0c;能够使用户更方便的访问互联网。他主要负责把域名和IP的相互转换&#xff0c;DNS运行与TCP|UDP的53端口上。 2. 高速缓存DNS&#xff1a;DNS服务…

Apache服务配置

1. apache 企业中常用的web服务。用来提供http&#xff1a;//&#xff08;超文本传输协议&#xff09; 基础信息&#xff1a; 主配置目录&#xff1a; /etc/httpd/conf 主配置文件&#xff1a; /etc/httpd/conf/httpd.conf 子配置目录&#xff1a; /etc/httpd/conf.d/ 子配置文…

如何安装Genymotion虚拟机以及Genmotion的eclipse插件

---内容开始--- - 首先去genymotion的官网去下载其安装文件 资源下载 Genymotion官网必须注册一个账号这个账号安装之后还有用的&#xff0c;用户名最好用网易126邮箱注册----我下载的是2.8.0的版本(注&#xff1a;注册前先开个代理服务器不然页面打不开下载时最好用迅雷下载这…

squid服务配置(正向、反向代理)

代理&#xff1a; 就是代理网络用户去取得网络信息。 Squid是一种用来缓冲Internet数据的软件。安装Squid服务实现代理缓存服务器功能。 正向代理&#xff1a;意思是一个位于客户端和原始服务器之间的服务器&#xff0c;为了从原始服务器取得内容&#xff0c;客户端向代理发送一…

c语言getchar函数_C语言中带有示例的getchar()函数

c语言getchar函数C语言中的getchar()函数 (getchar() function in C) The getchar() function is defined in the <stdio.h> header file. getchar()函数在<stdio.h>头文件中定义。 Prototype: 原型&#xff1a; int getchar(void);Parameters: FILE *filename(f…