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

Detailed explanation of MySQL data rows and row overflow mechanism

1. What are the formats of lines? You can see you...

Responsive Web Design Learning (2) — Can videos be made responsive?

Previous episode review: Yesterday we talked abou...

When to use table and when to use CSS (experience sharing)

The main text page of TW used to have a width of 8...

Writing a rock-paper-scissors game in JavaScript

This article shares the specific code for writing...

How to use multi-core CPU to speed up your Linux commands (GNU Parallel)

Have you ever had the need to compute a very larg...

A simple way to restart QT application in embedded Linux (based on QT4.8 qws)

Application software generally has such business ...

Detailed explanation of the problem of configuring servlet url-pattern in tomcat

When configuring web.xml for tomcat, servlet is a...

JavaScript to achieve simple tab bar switching case

This article shares the specific code for JavaScr...

Detailed installation tutorial of mysql 5.7 under CentOS 6 and 7

You always need data for development. As a server...

Solution to ONLY_FULL_GROUP_BY error in Mysql5.7 and above

Recently, during the development process, the MyS...

mysql 5.7.18 winx64 password change

After MySQL 5.7.18 is successfully installed, sin...

Mysql error: Too many connections solution

MySQL database too many connections This error ob...