HTML basics - CSS style sheets, style attributes, format and layout details

HTML basics - CSS style sheets, style attributes, format and layout details

1. position : fixed

Locked position (relative to the browser), such as the pop-up window in the lower right corner of some websites.

Example:

2. position : absolute

Absolute Position:

1. The outer layer does not have position: absolute (or relative); then the div is positioned relative to the browser, as shown in b in the following figure (50 pixels from the right border of the browser and 20 pixels from the bottom border).

2. The outer layer has position: absolute (or relative); then the div is positioned relative to the outer border, such as bb in the figure below (50 pixels from the right border of d and 20 pixels from the bottom border of d).

Example:

3. position : relative

Relative position:

As shown in the figure below, it is fixed relative to a certain position of the div that contains this div. If the outer layer does not contain it, then the relative position is fixed relative to the browser.

Example:

4. Layering ( z-index )

Layering in the z -axis direction can be understood as dividing into a stack of papers, with the higher the number of layers, the closer they are to the top.

In the relative example above, we see that aa covers a. This is because the display level of the later-written code is closer to the front. So how can we make a cover aa without changing the order of the code? as follows:

Example:

5. float : left , right

When using Left or right , there is no need to specify the position ( left or top ), it is directly relative to the browser. If the outer part is wrapped, it is displayed at the upper left or upper right position relative to the outer div except for one row.

Additional: 1. overflow: hidden; //Hide the excess part; scroll, display the scroll bar;

<div ></div> //Truncate the flow

2. cursor: the shape of the pointer when the mouse is pointing to it;

3. Translucent effect:

<div class="box">Transparent area<div>

The code in the style sheet is:

.box

{

opacity:0.5; -moz-opacity:0.5 ; filter:alpha(opacity=50)

}

To sum up the practice example: make part of the format layout of the druba website

HTML code:

XML/HTML CodeCopy content to clipboard
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >   
  2. < html   xmlns = "http://www.w3.org/1999/xhtml" >   
  3. < head >   
  4. < meta   http-equiv = "Content-Type"   content = "text/html; charset=utf-8"   />   
  5. < title > Untitled Document </ title >   
  6. < style   type = "text/css" >   
  7. .a
  8. {
  9. border:5px solid blue;
  10. width:1000px;
  11. height:100px;
  12. margin:10px;
  13. left:150px;
  14. top:80px;
  15. position:absolute;}
  16. .b
  17. {
  18. border:5px solid blue;
  19. width:240px;
  20. height:200px;
  21. margin:10px;
  22. left:150px;
  23. top:200px;
  24. position:absolute;}
  25. .c
  26. {
  27. border:5px solid blue;
  28. width:740px;
  29. height:300px;
  30. margin:10px;
  31. left:410px;
  32. top:200px;
  33. position:absolute;}
  34. .d
  35. {
  36. border:5px solid blue;
  37. width:740px;
  38. height:200px;
  39. margin:10px;
  40. left:410px;
  41. top:520px;
  42. position:absolute;}
  43. .e
  44. {
  45. border:5px solid blue;
  46. width:240px;
  47. height:1500px;
  48. margin:10px;
  49. left:150px;
  50. top:420px;
  51. position:absolute;}
  52. .f
  53. {
  54. border:5px solid blue;
  55. width:240px;
  56. height:150px;
  57. margin:10px;
  58. left:150px;
  59. top:1940px;
  60. position:absolute;}
  61. .g
  62. {
  63. border:5px solid blue;
  64. width:740px;
  65. height:1350px;
  66. margin:10px;
  67. left:410px;
  68. top:740px;
  69. position:absolute;}
  70. .h
  71. {
  72. border:5px solid blue;
  73. width:1000px;
  74. height:200px;
  75. margin:10px;
  76. left:150px;
  77. top:2110px;
  78. position:absolute;}
  79. .i
  80. {
  81. border:5px solid blue;
  82. width:1000px;
  83. height:200px;
  84. margin:10px;
  85. left:150px;
  86. top:2330px;
  87. position:absolute;}
  88. </ style >   
  89. </ head >   
  90.   
  91. < body   bgcolor = "#F0F0F0" >   
  92. < div   class = "a" > a </ div >   
  93. < div   class = "b" > b </ div >   
  94. < div   class = "c" > c </ div >   
  95. < div   class = "d" > d </ div >   
  96. < div   class = "e" > e </ div >   
  97. < div   class = "f" > f </ div >   
  98. < div   class = "g" > g </ div >   
  99. < div   class = "h" > h </ div >   
  100. < div   class = "i" > i </ div >   
  101. </ body >   
  102. </ html >   

Web page operation display effect diagram:

The above article on basic HTML knowledge - detailed explanation of CSS style sheets, style attributes, format and layout is all the content that the editor shares with you. I hope it can give you a reference, and I also hope that you will support 123WORDPRESS.COM.

Original URL: http://www.cnblogs.com/H2921306656/archive/2016/07/10/5658870.html

<<:  Some front-end basics (html, css) encountered in practice

>>:  Basic usage of JS date control My97DatePicker

Recommend

How to get form data in Vue

Table of contents need Get data and submit Templa...

JavaScript implements displaying a drop-down box when the mouse passes over it

This article shares the specific code of JavaScri...

Windows 10 + mysql 8.0.11 zip installation tutorial detailed

Prepare: MySQL 8.0 Windows zip package download a...

HTML reuse techniques

HTML reuse is a term that is rarely mentioned. Tod...

Small program to implement a simple calculator

This article example shares the specific code of ...

Exploring the Linux Kernel: The Secrets of Kconfig

Get a deep understanding of how the Linux configu...

How to maintain MySQL indexes and data tables

Table of contents Find and fix table conflicts Up...

IE8 provides a good experience: Activities

Today I had a sneak peek at IE8 beta 1 (hereafter...

Introduction to the use of MySQL pt-slave-restart tool

Table of contents When setting up a MySQL master-...

How to create a child process in nodejs

Table of contents Introduction Child Process Crea...

Two ways to correctly clean up mysql binlog logs

mysql correctly cleans up binlog logs Preface: Th...

Three ways to check whether a port is open in a remote Linux system

This is a very important topic, not only for Linu...

$nextTick explanation that you can understand at a glance

Table of contents 1. Functional description 2. Pa...