search
HomeWeb Front-endHTML TutorialThe nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose

The following essence comes from the following link, "http://www.aa25.cn/special/10day/index.shtml", "Ten Days Institute Web Standard (DIV CSS)".

  1. Do not delete this content: "", deleting it may cause some style sheets to fail or other unexpected problems.
  2. According to xhtml specifications, tags must be in lowercase. Single tags include The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose,
    ......
  3. There are four types of loading css styles: external style;Internal style;Inline style

    Internal style

    ;Import style @import url("/css/global.css");
  4. css priority: id priority is higher than class; subsequent styles Override the previous one; the specified one is higher than inheritance; inline style is higher than internal or external style; summary: single (id) is higher than shared (class), if it is specified, use the specified one, if not specified, inherit the closest
  5. css box model: The width of the entire box model on the page is composed of the left border, left border, left padding, right padding, right padding, right border, and right border. The width defined by width in the css style is only the content part. Width
  6. Change your concept: If you want to learn div+css well, you must first change your concept. You need to abandon the traditional table (Table) layout, adopt layer (DIV) layout, and use Cascading Style Sheets (CSS) to realize the page layout. Appearance. Give website visitors a better experience.
  7. Be sure to use more hands and brains, and don’t be afraid of trouble.
  8. Two common interfaces in DW:                                                                                                  🎜>

  9. Box model centered: #layout { height: 300px; width: 400px; background: #99FFcc; margin: auto; }
  10. Adaptive width is relative to the browser, and the width of the box model changes as the browser width changes. In this case, the percentage of width is used. When a box model does not set a width, it defaults to being displayed relative to the browser.

    When we do not define it with any style sheet, elements such as body, h1-h6, ul etc. have margins or other styles by default. Here we add an item to the css style: body {margin:0;}, so that the default outer margin of the body can be removed
  11. css code, each class or ID is written on one line
  12. id has a higher priority than class
  13. Add a parent div in addition to the two divs, and then set it to be centered to center the two divs.
  14. Block-level element: It is a box, like a paragraph, which occupies one line by default; such as paragraph

    , title

    ..., list,
    1. , table, form, DIV
      and BODY and other elements.
    2. Inline element: Also called inline element, as the name suggests, it can only be placed within a line, just like a word, without causing line breaks before and after, and plays an auxiliary role. Such as: form element , hyperlink , image The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose,
    3. In CSS, any element can be floated. The floating element will generate a block-level box, regardless of what kind of element it is; and a width must be specified, otherwise it will be as narrow as possible; in addition, when the space available for floating is less than the floating element, it will run to the next line , until you have enough space to put it down.

    4. Careful friends have discovered that in the above example, the #main div also defines margin-left:120px; which is not defined here, but the extra text runs into the image (#side) Below, after setting margin-left:, will it not run to the text of #side? If you can think of this, you are indeed too smart. It is indeed the case. Add the following line to the css style sheet
    5. #main { margin-left:202px;}

    6. The 3-pixel bug is a famous bug in IE6. When a floating element is adjacent to a non-floating element, this 3-pixel bug will appear. To solve this problem, please add _margin-right:-3px on #side; remember to add an underscore in front so that this style will take effect specifically for IE6. It will still display normally under IE7 and FF.
    7. # is a virtual link and does not point to any page.
    8. Remove the default label styles body, ul, li, h1, h2, h3, h4, h5, h6, p, form, dl, dt, dd { margin: 0px; padding: 0px; font-size: 12px; font-weight: normal; }
      ul { list-style: none; }
      img { border-style: none; }
    9. #menu ul and #menu ul li are derived Selector, if we remove the #menu in front, then the ul tag will be redefined, and the redefined attributes will be applied globally. After adding #menu in front, it will be defined as the style of ul in the menu element. Setting its style only takes effect on the ul under #menu, not the ul after it. This is a bit like a local variable in programming, and directly defining ul is equivalent to a global variable. #menu ul li is defined as the li under ul within the menu element. The derived selector allows us to no longer need to define a style name for each li to define the style. We only need to use the derived selector to select from its parent element. That’s it, this can greatly improve efficiency.
    10. You can group selectors so that grouped selectors share the same declaration. Use commas to separate selectors that need to be grouped. In the example below, we have grouped all heading elements. All title elements are green, and p paragraphs, div partitions, and spans are all 20 pixel fonts.

      h1,h2,h3,h4,h5,h6 {
      color: green;
      }
      p,div,span{
      font-size:20px;
      }

    11. Vertical secondary list

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><script type="text/javascript"><!--//--><![CDATA[//><!--startList = function() {if (document.all&&document.getElementById) {navRoot = document.getElementById("menu");var allli = navRoot.getElementsByTagName("li")for (i=0; i<allli.length; i++) {node = allli[i];node.onmouseover=function() {this.className+=" current";}node.onmouseout=function() {this.className=this.className.replace(" current", "");}}}}window.onload=startList;//--><!]]></script><style type="text/css">body { font-family: Verdana; font-size: 12px; line-height: 1.5; }img { border-style: none; }a { color: #000; text-decoration: none; }a:hover { color: #F00; }#menu { width: 100px; border: 1px solid #CCC; border-bottom:none;}#menu ul { list-style: none; margin: 0px; padding: 0px; }#menu ul li { background: #eee; padding: 0px 8px; height: 26px; line-height: 26px; border-bottom: 1px solid #CCC; position:relative; }#menu ul li ul { display:none; position: absolute; left: 100px; top: 0px; width:100px; border:1px solid #ccc; border-bottom:none; }#menu ul li.current ul { display:block;}#menu ul li:hover ul { display:block;}</style></head><body><div id="menu"><ul><li><a href="#">首页</a></li><li><a href="#">网页版式布局</a><ul><li><a href="#">自适应宽度</a></li><li><a href="#">固定宽度</a></li></ul></li><li><a href="#">div+css教程</a><ul><li><a href="#">新手入门</a></li><li><a href="#">视频教程</a></li><li><a href="#">常见问题</a></li></ul></li><li><a href="#">div+css实例</a></li><li><a href="#">常用代码</a></li><li><a href="#">站长杂谈</a></li><li><a href="#">技术文档</a></li><li><a href="#">资源下载</a></li><li><a href="#">图片素材</a></li></ul></div></body></html>

      Next, modify the css style sheet, first modify #menu ul li, and add a position:relative; attribute to it; After defining display:none, it will be hidden by default; define #menu ul li ul's position: absolute; left: 100px; top: 0px;, then it will be 0 relative to the top of its parent element li, and 100 to the left The location is displayed. Finally, we set the style to display the lower-level menu when the mouse moves over it; #menu ul li:hover ul. This style is difficult to understand. It means to define the ID of ul under menu and li under menu. When the mouse moves over, the style of ul is set to display:block refers to displaying this piece of content when the mouse moves over it, which also achieves the effect we want today.

    12. Relative positioning and absolute positioning: 1.position:relative; If an element is relatively positioned, first it will appear at its location. Then move the element "relative to" its original starting point by setting a vertical or horizontal position. (One more point, when positioned relatively, the element still occupies the original space regardless of whether it is moved. Therefore, moving the element will cause it to cover other boxes)

      2.position:absolute; means absolute positioning, and the position will be based on Starting from the upper left corner of the browser. Absolute positioning takes the element out of the document flow so it doesn't take up space. Elements in normal document flow are laid out as if absolutely positioned elements were not present. (Because absolutely positioned boxes have nothing to do with document flow, they can cover other elements on the page and their hierarchical order can be controlled by z-index. The higher the z-index, the further up it appears.)

      3. After the parent container uses relative positioning and the child element uses absolute positioning, the position of the child element is no longer relative to the upper left corner of the browser, but relative to the upper left corner of the parent container

      4. Relative Positioning and absolute positioning need to be used with top, right, bottom, and left to locate the specific position. These four attributes only take effect after the element is positioned, and are invalid in other cases. In addition, these four attributes can only use two adjacent ones at the same time. You cannot use up and down at the same time, or use left and right at the same time

    13. a:link {color: #FF0000} /* 未访问的链接 */
      a:visited {color: #00FF00} /* 已访问的链接 */
      a:hover {color: #FF00FF} /* 鼠标移动到链接上 */
      a:active {color: #0000FF} /* 选定的链接 */                                                                                                                                                      注意:四种状态的顺序一定不能颠倒,否则有些不生效
    14. 链接在默认状态下是内联元素,转换为块级元素后可以获得更大的点击区域,可以设置宽度和高度,将链接转换为块状,只需增加一个display:block的css属性即可。
    15. 学会了把超链接转换为块级元素,想制作个css按钮简直太简单了,只需在上一步的基础上增加一个按钮的背景图片即可实现。下面以制作淘宝网首页的免费注册按钮来讲解,设置最常用的默认样式和鼠标移上时的样式,如下图

       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=gb2312" /> 5 <style type="text/css"> 6 a { display: block; height: 34px; width: 107px; line-height: 2; text-align: center; background: url(/upload/2010-08/14/014304_btn_bg.gif) no-repeat 0px 0px; color: #d84700; font-size: 14px; font-weight: bold; text-decoration: none; padding-top: 3px; } 7 a:hover { background: url(/upload/2010-08/14/014304_btn_bg_hover.gif) no-repeat 0px 0px;} 8 </style> 9 </head>10 <body>11 <p><a href="#">免费注册</a></p>12 </body>13 </html>

    16. 首字下沉

       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=gb2312" /> 5 <style type="text/css"> 6 p { width: 400px; line-height: 1.5; font-size: 14px; } 7 p:first-letter { font-family: "microsoft yahei"; font-size: 40px; float: left; padding-right: 10px; line-height: 1; } 8 </style> 9 </head>10 <body>11 <p>标准之路[www.aa25.cn]提供DIV+CSS教程,DIV+CSS视频教程,web2.0标准,DIV+CSS布局入门教程,网页布局实例,css布局实例,div+css模板,div+css实例解析,网站重构,网页代码,水晶图标,幻灯广告图片.教程适合初学者循序渐进学习!</p>12 </body>13 </html>

    17. 无序列表,是以ul包含li的形式,默认每行前的符号是圆点,可以通过样式表改为无、方块,空心圆等。有序列表是以ol包含li的形式,是以数字为项目符号的,无序列表也可以用css定义显示成有序列表
    18. 改变项目符号样式或用图片定义项目符号:项目符号还可以以图像形式,如下图:                                                                                                这种形式对图像控制不是很灵活,所以实际应用当中一般用背景图片来实现,在上例基础上将项目符号设置为 list-style: none;,然后

       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=gb2312" /> 5 <style type="text/css"> 6 #layout ul { list-style: none; } 7 #layout ul li { background: url(/upload/2010-08/17/icon.gif) no-repeat 0px 4px; padding-left: 20px; } 8 </style> 9 </head>10 <body>11 <div id="layout">12 <ul>13 <li><a title="第五天 超链接伪类" href="/div_css/906.shtml" target="_blank">第五天 超链接伪类</a></li>14 <li><a title="第四天 纵向导航菜单" href="/div_css/905.shtml" target="_blank">第四天 纵向导航菜单</a></li>15 <li><a title="第三天 二列和三列布局" href="/div_css/904.shtml" target="_blank">第三天 二列和三列布局</a></li>16 <li><a title="第二天 一列布局" href="/div_css/903.shtml" target="_blank">第二天 一列布局</a></li>17 <li><a title="第一天 XHTML CSS基础知识" href="/div_css/902.shtml" target="_blank">第一天 XHTML CSS基础知识</a></li>18 </ul>19 </div>20 </body>21 </html>

    19. 横向图文列表是在上一步的基础上增加图片并让列表横向排列

       1 <div id="layout"> 2 <ul> 3 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="images/pic.gif"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li> 4 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="images/pic.gif"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li> 5 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="images/pic.gif"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li> 6 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="images/pic.gif"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li> 7 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="images/pic.gif"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li> 8 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="images/pic.gif"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li> 9 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="images/pic.gif"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>10 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="images/pic.gif"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>11 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="images/pic.gif"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>12 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="images/pic.gif"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>13 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="images/pic.gif"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>14 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="images/pic.gif"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>15 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="images/pic.gif"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>16 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="images/pic.gif"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>17 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="images/pic.gif"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>18 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="images/pic.gif"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>19 </ul>20 </div>

      接下来添加css样式,这里用到一个很重要的css属性:float,这个属性在第三天的教程当中已详细讲解过,这里不太赘述。先添加如下全局样式:

      body { margin:0 auto; font-size:12px; font-family:Verdana; line-height:1.5;}
      ul,dl,dt,dd,h1,h2,h3,h4,h5,h6,form { padding:0; margin:0;}
      ul { list-style:none;}
      img { border:0px;}
      a { color:#05a; text-decoration:none;}
      a:hover { color:#f00;}

      然后让每个li元素浮动起来,这样就实现了横向排列                                                                                                                                                      根据上节课的内容,把a转换为块级元素后可以设置宽高并增大点击区域

       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=gb2312" /> 5 <style type="text/css"> 6 body { margin:0 auto; font-size:12px; font-family:Verdana; line-height:1.5;} 7 ul,dl,dt,dd,h1,h2,h3,h4,h5,h6,form { padding:0; margin:0;} 8 ul { list-style:none;} 9 img { border:0px;}10 a { color:#05a; text-decoration:none;}11 a:hover { color:#f00;}12 #layout ul li { width:72px; float:left; margin:20px 0 0px 20px; display:inline; text-align:center;}13 #layout ul li a { display:block;}14 #layout ul li a img { padding:1px; border:1px solid #e1e1e1; margin-bottom:3px;}15 #layout ul li a:hover img { padding:0px; border:2px solid #f98510;}16 </style>17 </head>18 <body>19 <div id="layout">20 <ul>21 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="/upload/2010-08/17/pic.jpg"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>22 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="/upload/2010-08/17/pic.jpg"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>23 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="/upload/2010-08/17/pic.jpg"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>24 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="/upload/2010-08/17/pic.jpg"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>25 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="/upload/2010-08/17/pic.jpg"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>26 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="/upload/2010-08/17/pic.jpg"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>27 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="/upload/2010-08/17/pic.jpg"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>28 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="/upload/2010-08/17/pic.jpg"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>29 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="/upload/2010-08/17/pic.jpg"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>30 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="/upload/2010-08/17/pic.jpg"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>31 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="/upload/2010-08/17/pic.jpg"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>32 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="/upload/2010-08/17/pic.jpg"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>33 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="/upload/2010-08/17/pic.jpg"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>34 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="/upload/2010-08/17/pic.jpg"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>35 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="/upload/2010-08/17/pic.jpg"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>36 <li><a href="#"><img  src="/static/imghwm/default1.png"  data-src="/upload/2010-08/17/pic.jpg"  class="lazy"    style="max-width:90%"  style="max-width:90%" / alt="The nutritional essence of the article 'Ten Days to Learn Web Standards (div css)' on the Standard Road website_html/css_WEB-ITnose" >三亚</a></li>37 </ul>38 </div>39 </body>40 </html>

    20. 当一个容器内元素都浮动后,它将高度将不会随着内部元素高度的增加而增加,所以造成内容元素的显示超出了容器。

      要解决这个问题,需要使用以下样式

      overflow:auto; zoom:1;

      overflow:auto;是让高度自适应, zoom:1;是为了兼容IE6而写

    21. 由于不同的浏览器,比如IE 6,IE 7,IE8,Mozilla Firefox等,对CSS的解析认识不一样,因此会导致生成的页面效果不一样,得不到我们所需要的页面效果。这个时候我们就需要针对不同的浏览器去写不同的CSS,让它能够同时兼容不同的浏览器,能在不同的浏览器中也能得到我们想要的页面效果。 这个针对不同的浏览器写不同的CSS code的过程,就叫CSS hack。这里的overflow:auto; zoom:1;就是所谓的css hack,这种形式是应用我们常用的代码来解决不兼容问题,也会用到添加一些特殊符号的形式,它本身没有意义,只是针对不同浏览器是否对它识别来实现的
    22. IE6双倍编辑bug,这又是IE6一个著名的bug,也是我们经常遇到的。如上例,当浮动后设置左侧外边距时后,最左侧将显示为双倍边距,比如设置为20,而在IE6下却显示40px,解决这个问题只需应用一个样式,大家记住就可以了

      1. display:inline;

    23. CSS Sprites在国内很多人叫css精灵或css雪碧。它是把网页中一些背景图片整合到一张图片文件中,再利用CSS的背景图片定位到要显示的位置。这样做可以减少文件体积,减少对服务器的请求次数,提高效率。

      讲CSS Sprites之前,先把背景图片给搞清楚

      #menu ul li a { background:#ccc url(images/nav_bg2.gif) 0 0 no-repeat; }

      css背景属性缩写后如上所示,#ccc表示背景色;url()里是背景图片路径;接下来的两个数值参数分别是左右和上下,第一个参数表示距左多少px,第二个参数表示距上多少,这和padding的简写方式是不 一样,一定不要弄混。另外再强调一点css中值为0可以不带单位,其它数值都必须带单位(line-height值为多少倍时,zoom,z-index除外);no-repeat表示背景图片向哪个方向重复,此时为不重复。

      还需说明一点的是定位图片位置的参数是以图片的左上角为原点的,理解了这些,CSS Sprites技术就基本上懂了,就是靠背景图片定位来实现的。

    24. 定位和浮动都可以分栏布局,到底什么时候用浮动,什么时候用定位呢?

      当一个元素使用绝对定位后,它的位置将依据浏览器左上角开始计算或相对于父容器(在父容器使用相对定位时)。 绝对定位使元素脱离文档流,因此不占据空间。普通文档流中元素的布局就当绝对定位的元素不存在时一样。因为绝对定位的框与文档流无关,所以它们可以覆盖页面上的其他元素。

      而浮动元素的定位还是基于正常的文档流,然后从文档流中抽出并尽可能远的移动至左侧或者右侧。文字内容会围绕在浮动元素周围。当一个元素从正常文档流中抽出后,仍然在文档流中的其他元素将忽略该元素并填补他原先的空间。它只是改变了文档流的显示,而没有脱离文档流,理解了这一点,就很容易弄明白什么时候用定位,什么时候用浮动了。

      一个元素浮动或绝对定位后,它将自动转换为块级元素,而不论该元素本身是什么类型。

    25. 宽度自适应按钮

       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=gb2312" /> 5 <style type="text/css"> 6 a { display: block; float:left; margin:5px; height: 37px;line-height: 37px; text-align: center; background: url(/upload/2010-08/17/091722_btn_bg.gif) no-repeat 0px 0px; color: #d84700; font-size: 14px; font-weight: bold; text-decoration: none; padding-left:18px; } 7 a span { display:block; background: url(/upload/2010-08/17/091722_btn_bg.gif) no-repeat right 0px; padding-right:20px;} 8 a:hover { background: url(/upload/2010-08/17/091722_btn_bg.gif) no-repeat 0px -37px;} 9 a:hover span{ background: url(/upload/2010-08/17/091722_btn_bg.gif) no-repeat right -37px;}10 </style>11 </head>12 <body>13 <p><a href="#"><span>免费注册</span></a><a href="#"><span>登录</span></a><a href="#"><span>在淘宝网上开店</span></a></p>14 </body>15 </html>

    26. 改变文本框和文本域样式;用图片美化按钮;改变下拉列表样式;用label标签提升用户体验。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
今日头条发布文章怎么才能有收益?今日头条发布文章获得更多收益方法!今日头条发布文章怎么才能有收益?今日头条发布文章获得更多收益方法!Mar 15, 2024 pm 04:13 PM

一、今日头条发布文章怎么才能有收益?今日头条发布文章获得更多收益方法!1.开通基础权益:原创文章选择投放广告可获得收益,视频必须要原创横屏才会有收益。2.开通百粉权益:粉丝量达到百粉以上,微头条、原创问答创作及问答均可获得收益。3.坚持原创作品:原创作品包含文章、微头条及问题等,要求300字以上。注意违规抄袭作品作为原创发布,会被扣信用分,即使有收益也会被扣除。4.垂直度:做专业领域一类的文章,不能随意跨领域写文章,会得不到合适的推荐,达不到作品的专和精,难以吸引粉丝读者。5.活跃度:活跃度高,

PHP函数库设计的原则和标准PHP函数库设计的原则和标准Jun 16, 2023 am 11:37 AM

随着PHP在Web开发中的重要性不断提高,PHP函数库设计也成为了开发中的关键问题之一。好的函数库不仅可以提高开发效率,还能保证代码的质量和可维护性。因此,设计函数库需要遵循一些基本原则和标准。一、可重用性好的函数库应该是可重用的,可以在不同的项目中使用。因此,函数应该是抽象的、通用的,不能和特定的项目或场景捆绑在一起。二、易用性函数库应该易于使用,传递参数

不容错过的精华:Go语言开源项目Top5简介不容错过的精华:Go语言开源项目Top5简介Jan 30, 2024 am 09:28 AM

Go语言是一种编译型的静态类型语言,由谷歌开发并于2009年首次公开。自公开以来,Go语言凭借其简洁、高效、安全以及并发性能等优势,迅速走红并得到广泛应用。作为开源项目的一部分,Go语言的生态系统也在不断壮大。本文将为大家盘点五个不可错过的Go语言开源项目,希望可以为大家提供一些参考和借鉴。Gorilla/muxGorilla/mux是一个强大而灵活的HTT

如何在HTML5中添加文章?如何在HTML5中添加文章?Sep 12, 2023 am 11:37 AM

在本文中,我们将学习如何在HTML5中添加文章。HTML5中的新分段元素之一是标记。文章使用标签以HTML形式表示。更具体地说,元素中包含的内容与网站的其余内容不同(即使它们可能相关)。让我们考虑以下示例来了解如何在HTML5中添加文章示例1在以下示例中,我们在文章元素中使用内联样式。<!DOCTYPEhtml><html><body><articlestyle="width:300px;border:2pxsolidgray;padding:

解读 Vitalik 新文:为什么 Blob 空间未被高效使用的 Rollup 陷入了发展困境?解读 Vitalik 新文:为什么 Blob 空间未被高效使用的 Rollup 陷入了发展困境?Apr 01, 2024 pm 08:16 PM

如何理解@VitalikButerin新文对以太坊的扩容思考?有人说Vitalik给Blob铭文喊单,离大谱。那么Blob数据包如何工作?坎昆升级后Blob空间为啥得不到高效利用?DAS数据可用性采样是为分片做准备?在我看来,坎昆升级后性能够用了,Vitalik是对Rollup发展忧心忡忡。Why?接下来,我来谈谈我的理解:在之前多次解释过,Blob是和EVMcalldata脱钩的一个直接可被共识层调取的临时数据包,直接好处是,EVM在执行交易时可以不访问Blob数据,因此产生了较低的执行层计算

微信同时发送文章和录音的详细方法微信同时发送文章和录音的详细方法Mar 26, 2024 am 09:16 AM

1、打开手机,点击微信软件,进入微信的主页设置。2、找到微信右下角【我的】打开,进入【我的】页面。3、点击收藏,然后打开新页面。

哪些标准可以用来对 PHP 函数进行分类?哪些标准可以用来对 PHP 函数进行分类?Apr 19, 2024 am 09:30 AM

PHP函数可按多种标准分类:目的(字符串处理、数组处理等)、作用域(内置函数、用户自定义函数)和返回值(有返回值、无返回值)。实战案例:explode()函数可将字符串以指定分隔符分割成数组。

头条搜索极速版发表文章有收益吗头条搜索极速版发表文章有收益吗Feb 29, 2024 pm 04:16 PM

头条搜索极速版软件不仅提供了丰富的文章内容供用户浏览,还为用户提供了一个展现自我、分享知识的平台。很多用户们都很想了解在头条搜索极速版中发布文章是否能够获得收益,那么今天本站小编就在下文中为大家详细介绍头条搜索极速版发表文章是否有收益以及怎么发表文章的详细介绍,希望能帮助到各位有需要的小伙伴们。头条搜索极速版发表文章有收益吗答案:有。1、首先我们打开头条搜索极速版软件,在首页中我们点击右上角的【加号图标】;2、然后就会来到发表文章的页面,在这里我们可以上传视频、照片、链接、输入文字等,都设置好之

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool