How to html adaptive, how to initialize css web pages, 16 beautiful container scroll bar css styles, the anchor mark of a tag is simple to use

Preface

"If you don't accumulate steps, you can't reach a thousand miles; if you don't accumulate small currents, you can't become a river"

(1) Set the style of a container in the center of the screen

    .style{
    
    
            position: absolute;              可以先使标签绝对定位
            left: 50%;                       让他左边距为整个网页  的50%;
            top: 50%;                        让他顶部距为  整个网页  的50%;
            margin-left: -600px;             再减去自声宽度  的一半
            margin-top: -200px;              减去自身高度的一半
            width: 1200px;
            height: 400px;
     }

(2) When the web page is initialized, the compatibility of each browser is different, so it is necessary to set each style to minimize the compatibility problems between browsers!

        body, div, address, blockquote, iframe, ul, ol, dl, dt,
        dd, li, dl, h1, h2, h3, h4, pre, table, caption, th, td, form,
        legend, fieldset, input, button, select, textarea {
    
    
            margin: 0;
            padding: 0;
            font-style: normal;
            font: 12px/22px Arial, Helvetica, sans-serif;
        }
        ol, ul, li {
    
    
            list-style: none;
        }
        img {
    
    
            border: 0;
            vertical-align: middle;
        }
        body {
    
    
            color: #000000;
            background: #FFF;
            text-align: center;
        }

(3) Hyperlink anchor mark

When using an anchor, you first need to identify a point in the current HTML page. The specific method is to add an attribute named name to the <a> tag, so that you can identify a point at the current position of the current page, and This clicks on a name;
 <h2 >< a name=“first_title” >the title of the first paragraph of the article< /a >< /h2> Then, use the href attribute of the <a> tag to refer to this name in other places on the page, When using this way, you need to add # in front of the applied anchor name: <a href="#first_title>
 returns the first title of the article. When the user clicks on this anchor with the mouse, it will return to the name with a buzzing sound Is the location of the webpage where the <a> tag of the attribute value of first_title is located, is it very magical. Some friends may say, what if there are two
 <a> tags whose name attribute values ​​are exactly the same in the webpage ? ? First of all, this is not in compliance with the specification, because the value of the name attribute should be unique in a web page;

<a href="#Login">点我去登录处</a>
<a href="#Regin">点我去注册处</a>
<div>测试数据</div>
<div>测试数据</div>
<div>测试数据</div>
<div>测试数据</div>
<div>测试数据</div>
<div>测试数据</div>
<div>测试数据</div>
<div>测试数据</div>
<a name="Regin">这里是标题登录处</a>
<div>测试数据</div>
<div>测试数据</div>
<div>测试数据</div>
<div>测试数据</div>
<div>测试数据</div>
<div>测试数据</div>
<div>测试数据</div>
<div>测试数据</div>
<div>测试数据</div>
<div>测试数据</div>
<a name="Login">这里是标题注册处 </a>
<div>测试数据</div>
<div>测试数据</div>
<div>测试数据</div>
<div>测试数据</div>
<div>测试数据</div>

(4) The nice style of the scroll bar

<style>
/*
 *  STYLE 1
 */

#style-1::-webkit-scrollbar-track
{
     
     
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
	border-radius: 10px;
	background-color: #F5F5F5;
}

#style-1::-webkit-scrollbar
{
     
     
	width: 12px;
	background-color: #F5F5F5;
}

#style-1::-webkit-scrollbar-thumb
{
     
     
	border-radius: 10px;
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
	background-color: #555;
}

/*
 *  STYLE 2
 */

#style-2::-webkit-scrollbar-track
{
     
     
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
	border-radius: 10px;
	background-color: #F5F5F5;
}

#style-2::-webkit-scrollbar
{
     
     
	width: 12px;
	background-color: #F5F5F5;
}

#style-2::-webkit-scrollbar-thumb
{
     
     
	border-radius: 10px;
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
	background-color: #D62929;
}

/*
 *  STYLE 3
 */

#style-3::-webkit-scrollbar-track
{
     
     
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
	background-color: #F5F5F5;
}

#style-3::-webkit-scrollbar
{
     
     
	width: 6px;
	background-color: #F5F5F5;
}

#style-3::-webkit-scrollbar-thumb
{
     
     
	background-color: #000000;
}

/*
 *  STYLE 4
 */

#style-4::-webkit-scrollbar-track
{
     
     
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
	background-color: #F5F5F5;
}

#style-4::-webkit-scrollbar
{
     
     
	width: 10px;
	background-color: #F5F5F5;
}

#style-4::-webkit-scrollbar-thumb
{
     
     
	background-color: #000000;
	border: 2px solid #555555;
}


/*
 *  STYLE 5
 */

#style-5::-webkit-scrollbar-track
{
     
     
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
	background-color: #F5F5F5;
}

#style-5::-webkit-scrollbar
{
     
     
	width: 10px;
	background-color: #F5F5F5;
}

#style-5::-webkit-scrollbar-thumb
{
     
     
	background-color: #0ae;
	background-image: -webkit-gradient(linear, 0 0, 0 100%,
	                   color-stop(.5, rgba(255, 255, 255, .2)),
					   color-stop(.5, transparent), to(transparent));
}


/*
 *  STYLE 6
 */
#style-6::-webkit-scrollbar-track
{
     
     
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
	background-color: #F5F5F5;
}

#style-6::-webkit-scrollbar
{
     
     
	width: 10px;
	background-color: #F5F5F5;
}

#style-6::-webkit-scrollbar-thumb
{
     
     
	background-color: #F90;	
	background-image: -webkit-linear-gradient(45deg,
	                                          rgba(255, 255, 255, .2) 25%,
											  transparent 25%,
											  transparent 50%,
											  rgba(255, 255, 255, .2) 50%,
											  rgba(255, 255, 255, .2) 75%,
											  transparent 75%,
											  transparent)
}


/*
 *  STYLE 7
 */

#style-7::-webkit-scrollbar-track
{
     
     
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
	background-color: #F5F5F5;
	border-radius: 10px;
}

#style-7::-webkit-scrollbar
{
     
     
	width: 10px;
	background-color: #F5F5F5;
}

#style-7::-webkit-scrollbar-thumb
{
     
     
	border-radius: 10px;
	background-image: -webkit-gradient(linear,
									   left bottom,
									   left top,
									   color-stop(0.44, rgb(122,153,217)),
									   color-stop(0.72, rgb(73,125,189)),
									   color-stop(0.86, rgb(28,58,148)));
}

/*
 *  STYLE 8
 */

#style-8::-webkit-scrollbar-track
{
     
     
	border: 1px solid black;
	background-color: #F5F5F5;
}

#style-8::-webkit-scrollbar
{
     
     
	width: 10px;
	background-color: #F5F5F5;
}

#style-8::-webkit-scrollbar-thumb
{
     
     
	background-color: #000000;	
}


/*
 *  STYLE 9
 */

#style-9::-webkit-scrollbar-track
{
     
     
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
	background-color: #F5F5F5;
}

#style-9::-webkit-scrollbar
{
     
     
	width: 10px;
	background-color: #F5F5F5;
}

#style-9::-webkit-scrollbar-thumb
{
     
     
	background-color: #F90;	
	background-image: -webkit-linear-gradient(90deg,
	                                          rgba(255, 255, 255, .2) 25%,
											  transparent 25%,
											  transparent 50%,
											  rgba(255, 255, 255, .2) 50%,
											  rgba(255, 255, 255, .2) 75%,
											  transparent 75%,
											  transparent)
}


/*
 *  STYLE 10
 */

#style-10::-webkit-scrollbar-track
{
     
     
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
	background-color: #F5F5F5;
	border-radius: 10px;
}

#style-10::-webkit-scrollbar
{
     
     
	width: 10px;
	background-color: #F5F5F5;
}

#style-10::-webkit-scrollbar-thumb
{
     
     
	background-color: #AAA;
	border-radius: 10px;
	background-image: -webkit-linear-gradient(90deg,
	                                          rgba(0, 0, 0, .2) 25%,
											  transparent 25%,
											  transparent 50%,
											  rgba(0, 0, 0, .2) 50%,
											  rgba(0, 0, 0, .2) 75%,
											  transparent 75%,
											  transparent)
}


/*
 *  STYLE 11
 */

#style-11::-webkit-scrollbar-track
{
     
     
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
	background-color: #F5F5F5;
	border-radius: 10px;
}

#style-11::-webkit-scrollbar
{
     
     
	width: 10px;
	background-color: #F5F5F5;
}

#style-11::-webkit-scrollbar-thumb
{
     
     
	background-color: #3366FF;
	border-radius: 10px;
	background-image: -webkit-linear-gradient(0deg,
	                                          rgba(255, 255, 255, 0.5) 25%,
											  transparent 25%,
											  transparent 50%,
											  rgba(255, 255, 255, 0.5) 50%,
											  rgba(255, 255, 255, 0.5) 75%,
											  transparent 75%,
											  transparent)
}

/*
 *  STYLE 12
 */

#style-12::-webkit-scrollbar-track
{
     
     
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.9);
	border-radius: 10px;
	background-color: #444444;
}

#style-12::-webkit-scrollbar
{
     
     
	width: 12px;
	background-color: #F5F5F5;
}

#style-12::-webkit-scrollbar-thumb
{
     
     
	border-radius: 10px;
	background-color: #D62929;
	background-image: -webkit-linear-gradient(90deg,
											  transparent,
											  rgba(0, 0, 0, 0.4) 50%,
											  transparent,
											  transparent)
}

/*
 *  STYLE 13
 */

#style-13::-webkit-scrollbar-track
{
     
     
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.9);
	border-radius: 10px;
	background-color: #CCCCCC;
}

#style-13::-webkit-scrollbar
{
     
     
	width: 12px;
	background-color: #F5F5F5;
}

#style-13::-webkit-scrollbar-thumb
{
     
     
	border-radius: 10px;
	background-color: #D62929;
	background-image: -webkit-linear-gradient(90deg,
											  transparent,
											  rgba(0, 0, 0, 0.4) 50%,
											  transparent,
											  transparent)
}

/*
 *  STYLE 14
 */

#style-14::-webkit-scrollbar-track
{
     
     
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.6);
	background-color: #CCCCCC;
}

#style-14::-webkit-scrollbar
{
     
     
	width: 10px;
	background-color: #F5F5F5;
}

#style-14::-webkit-scrollbar-thumb
{
     
     
	background-color: #FFF;
	background-image: -webkit-linear-gradient(90deg,
	                                          rgba(0, 0, 0, 1) 0%,
											  rgba(0, 0, 0, 1) 25%,
											  transparent 100%,
											  rgba(0, 0, 0, 1) 75%,
											  transparent)
}

/*
 *  STYLE 15
 */

#style-15::-webkit-scrollbar-track
{
     
     
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.1);
	background-color: #F5F5F5;
	border-radius: 10px;
}

#style-15::-webkit-scrollbar
{
     
     
	width: 10px;
	background-color: #F5F5F5;
}

#style-15::-webkit-scrollbar-thumb
{
     
     
	border-radius: 10px;
	background-color: #FFF;
	background-image: -webkit-gradient(linear,
									   40% 0%,
									   75% 84%,
									   from(#4D9C41),
									   to(#19911D),
									   color-stop(.6,#54DE5D))
}

/*
 *  STYLE 16
 */

#style-16::-webkit-scrollbar-track
{
     
     
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.1);
	background-color: #F5F5F5;
	border-radius: 10px;
}

#style-16::-webkit-scrollbar
{
     
     
	width: 10px;
	background-color: #F5F5F5;
}

#style-16::-webkit-scrollbar-thumb
{
     
     
	border-radius: 10px;
	background-color: #FFF;
	background-image: -webkit-linear-gradient(top,
											  #e4f5fc 0%,
											  #bfe8f9 50%,
											  #9fd8ef 51%,
											  #2ab0ed 100%);
}


</style>
</html>

Part of the scroll bar style effect
Insert picture description here

Scroll bar components

  1. ::-webkit-scrollbar The whole part of the scroll bar

  2. ::-webkit-scrollbar-thumb The small square inside the scroll bar can move up and down (or left and right)

  3. ::-webkit-scrollbar-track The track of the scroll bar (with Thumb)

  4. ::-webkit-scrollbar-button The buttons at the ends of the track of the scroll bar, because the position of the small square can be adjusted by clicking.

  5. ::-webkit-scrollbar-track-piece inner track, the middle part of the scroll bar

  6. ::-webkit-scrollbar-corner corner, which is where the vertical scroll bar and the horizontal scroll bar intersect

  7. ::-webkit-resizer A small control used to drag and resize the element at the intersection of the two scroll bars

Outside light inside the container

 box-shadow: inset 0 0 5em #ffd800, 0 0 5em #ffd800;

Guess you like

Origin blog.csdn.net/WenRouDG/article/details/108966589