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.pswp.cn/news/542175.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/542175.shtml
英文地址,請注明出處:http://en.pswp.cn/news/542175.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Linux中磁盤分區的管理

1. 本地存儲設備的識別 fdisk -l真實存在的設備cat /proc/partitions系統識別的設備blkid系統可使用的設備df系統正在掛載的設備 真實存在的設備不一定可識別&#xff0c;識別到的的設備不一定可使用 2. 設備的掛載和卸載 1&#xff09;設備名稱 /dev/xdx …

python中時間的加減_python日期加減

python中關于時間和日期函數的常用計算總結 python中關于時間和日期函數有time和datatime 1.獲取當前時間的兩種方法: import datetime,time now = time.strftime("%Y-%m-%d %H:%M:%S") print now now = datetime.datetime.now()... 文章 技術小胖子 2017-11-08 848…

bst 刪除節點_在BST中刪除大于或等于k的節點

bst 刪除節點Problem statement: 問題陳述&#xff1a; Given a BST and a value x, write a function to delete the nodes having values greater than or equal to x. The function will return the modified root. 給定一個BST和一個值x &#xff0c;編寫一個函數刪除值大…

游戲架構之二(轉)

棋牌類游戲常用架構&#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命令處理過的物理分…

pythonweb自動化測試實例_[轉載]python?webdriver自動化測試實例

python webdriver自動化測試初步印象以下示例演示啟動firefox&#xff0c;瀏覽google.com,搜索Cheese&#xff0c;等待搜索結果&#xff0c;然后打印出搜索結果頁的標題from selenium import webdriverfrom selenium.common.exceptions import TimeoutExceptionfrom selenium.w…

repeated_Ruby中帶有示例的Array.repeated_combination()方法

repeatedArray.repeated_combination()方法 (Array.repeated_combination() Method) In this article, we will study about Array.repeated_combination() method. You all must be thinking the method must be doing something which is related to creating combinations o…

ApacheHttpServer修改httpd.conf配置文件

轉自&#xff1a;https://blog.csdn.net/dream1120757048/article/details/77427351 1. 安裝完 Apache HTTP Server 之后&#xff0c;還需要修改一下配置文件。 Apache 的配置文件路徑如下&#xff1a; C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf…

大學物理實驗電學基本參數的測量實驗報告_大學物理電學實驗報告

技校網專門為您推薦的類似問題答案問題1&#xff1a;怎樣寫大學計算機基礎有關制作個人簡歷的實驗報告一、實驗名稱&#xff1a;個人簡歷的制作 二、實驗目的與要求: 1、熟悉Word 2003的基本操作 2、掌握利用網絡搜索獲得個人簡歷所需的資料 3、培養同學們動手能力和自學能力。…

python 線程模塊_Python線程模塊| main_thread()方法與示例

python 線程模塊Python threading.main_thread()方法 (Python threading.main_thread() Method) main_thread() is an inbuilt method of the threading module in Python. It is used to return the main Thread object. It is the thread from which the Python interpreter …

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…

查看scala變量數據類型_Scala文字,變量和數據類型| Scala編程教程

查看scala變量數據類型1)Scala數據類型 (1) Scala Data Types) Scala has the same set of data types as in Java. The traditional 14 data types are inherited as it is in Scala. Scala具有與Java中相同的數據類型集。 傳統的14種數據類型在Scala中被繼承。 The Followin…

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…