• <bdo id="uwcuo"></bdo>
    • <dl id="uwcuo"><tr id="uwcuo"></tr></dl>
    • <nav id="uwcuo"><tfoot id="uwcuo"></tfoot></nav>
      17
      我是文本,哈哈,我想要在父容器中水平居中顯示。<\/div>18 <\/body>19 <\/html><\/pre> <\/p>

      <\/p>

      The rendering is as follows: <\/p>

      <\/p>

      ☆ Horizontal centering setting - fixed-width block element <\/strong><\/p>

      When the element to be set is a block element, text-align: center will not work. There are two situations: fixed-width block Shape elements and block elements of variable width. Let’s take a look at fixed-width block elements first.
      Elements that meet the two conditions of fixed width and block can be centered by setting the \"left and right margin\" value to \"auto\". Let's look at an example of setting the div block element to be horizontally centered:
      html code: <\/p>

       1  2  3  4  5 定寬塊狀元素水平居中<\/title> 6 <style> 7 div{ 8     border:1px solid red; 9     width:500px;10     margin:20px auto;11 }12 <\/style>13 <\/head>14 <body>
      <h1><a href="http://www.miracleart.cn/">国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂</a></h1>15 <div>我是定寬塊狀元素,哈哈,我要水平居中顯示。<\/div>16 <\/body>17 <\/html><\/pre> <\/p> <p> <\/p> <p><br \/>Note: the \" The upper and lower margins can be set at will. <\/p> <p>The rendering is as follows: <\/p> <p> <\/p> <p><strong>☆Horizontal centering setting - variable width block element method (1) <\/strong><\/p> <p> In practice At work, we will encounter the need to set the center for \"block elements with variable widths\", such as pagination navigation on a web page. Because the number of paginations is uncertain, we cannot limit its flexibility by setting the width. <br \/>There are three methods for centering block elements with variable widths (these three methods are currently used more often): <br \/>1. Add the table tag <br \/>2. Set the display; inline method <br \/>3. Set position:relative and left:50%;<br \/>Let’s look at the first method first: <br \/>Step 1: Add a table tag (including <tbody>, <tr>) outside the centered element that needs to be set. ,<td> ). <br \/>Step 2: Set the \"left and right margins to be centered\" for this table (this is the same method as the fixed-width block element). <br \/>For example: <br \/>html code: <\/p> <p class=\"sycode\"> <pre class='brush:php;toolbar:false;'> 1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset=\"utf-8\"> 5 <title>不定寬塊狀元素水平居中<\/title> 6 <style> 7 table{ 8     margin:0 auto; 9 }10 ul{list-style:none;margin:0;padding:0;}11 li{float:left;display:inline;margin-right:8px;}12 <\/style>13 <\/head>14 <body>15 <div>16 <table>17   <tbody>18     <tr><td>19     <ul>20         <li><a href=\"#\">1<\/a><\/li>21         <li><a href=\"#\">2<\/a><\/li>22         <li><a href=\"#\">3<\/a><\/li>23     <\/ul>24     <\/td><\/tr>25   <\/tbody>26 <\/table>27 <\/div>28 <\/body>29 <\/html><\/pre> <\/p> <p> <\/p> <p>The rendering is as follows: <\/p> <p> <\/p> <p><strong>☆Horizontal centering setting - variable width block element method (2) <\/strong><\/p> <p> The second method: change the display of the block-level element to inline type, and then use text-align:center to achieve centering Effect. The following example: <br \/>html code: <\/p> <p class=\"sycode\"> <pre class='brush:php;toolbar:false;'> 1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset=\"utf-8\"> 5 <title>不定寬塊狀元素水平居中<\/title> 6 <style> 7 .container{text-align:center;} 8 .container ul{list-style:none;margin:0;padding:0;display:inline;} 9 .container li{margin-right:8px;display:inline;}10 <\/style>11 <\/head>12 13 <body>14 <div   id="377j5v51b"   class=\"container\">15     <ul>16         <li><a href=\"#\">1<\/a><\/li>17         <li><a href=\"#\">2<\/a><\/li>18         <li><a href=\"#\">3<\/a><\/li>19     <\/ul>20 <\/div>21 <\/body>22 <\/html><\/pre> <\/p> <p>The advantage of this method compared to the first method is that there is no need to add unsemantic tags, which simplifies the nesting depth of tags. But there are also some problems: it changes the display type of the block element to inline, turning it into an inline element, so it loses some functions, such as setting the length value. (The effect picture is as shown in the method one) <\/p> <p><strong>☆Horizontal centering setting - variable width block element method (3) <\/strong><\/p> <p>Method three: By setting float to the parent element, Then set position:relative and left:50% for the parent element, and set position:relative and left:-50% for the child element to achieve horizontal centering. <br \/>html code: <\/p> <p class=\"sycode\"> <pre class='brush:php;toolbar:false;'> 1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset=\"utf-8\"> 5 <title>不定寬塊狀元素水平居中<\/title> 6 <style> 7 .container{ 8     float:left; 9     position:relative;10     left:50%11 }12 .container ul{13     list-style:none;14     margin:0;15     padding:0;16     17     position:relative;18     left:-50%;19 }20 .container li{float:left;display:inline;margin-right:8px;}21 <\/style>22 <\/head>23 24 <body>25 <div   id="377j5v51b"   class=\"container\">26     <ul>27         <li><a href=\"#\">1<\/a><\/li>28         <li><a href=\"#\">2<\/a><\/li>29         <li><a href=\"#\">3<\/a><\/li>30     <\/ul>31 <\/div>32 <\/body>33 <\/html><\/pre> <\/p> <p> This method can retain block elements and still display them in the form of display:block. The advantage is that no silent discussion tags are added and no nesting is added. Depth, but its disadvantage is that position:relative is set, which brings certain side effects. These three methods are widely used and each has its own advantages and disadvantages. Which method to choose depends on the specific situation. (The effect picture is as shown in the method one) <\/p> <p><strong>Vertical centering setting<\/strong><\/p> <p><strong>☆Vertical centering - a single line of text with a determined height of the parent element<\/strong><\/p> <p> The method of vertically centering a single line of text whose height is determined by the parent element is achieved by setting the height and line-height of the parent element to be consistent. The following code: <\/p> <p class=\"sycode\"> <pre class='brush:php;toolbar:false;'> 1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset=\"utf-8\"> 5 <title>垂直居中<\/title> 6 <style> 7 .wrap h2{ 8     margin:0; 9     height:100px;10    line-height:100px;11     background:#ccc;12 }13 <\/style>14 <\/head>15 <body>16 <div   id="377j5v51b"   class=\"wrap\">17     <h2>hello,world!<\/h2>18 <\/div>19 <\/body>20 <\/html><\/pre> <\/p> <p> <\/p> <p>Rendering: <\/p> <p> <\/p> <p> <\/p> <p><strong>☆Vertical Centering - Multi-line text with a certain height of the parent element (Method 1) <\/strong><\/p> <p> There are two ways to vertically center multi-line text, pictures, and block elements with a certain height of the parent element: <br \/> Method 1: Use insert table (including tbody, tr, td) tags, and set vertical-align: middle. <br \/> Speaking of vertical centering, there is an attribute vertical-align in CSS for vertical centering, but this style will only take effect when the parent element is td or th. So we have to insert the table tag again. Let’s take a look at an example: <br \/>html code: <\/p>   <p class=\"sycode\">    <pre class='brush:php;toolbar:false;'> 1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta  charset=\"utf-8\"> 5 <title>父元素高度確定的多行文本<\/title> 6 <style> 7   .wrap{height:300px;background:#ccc} 8 <\/style> 9 <\/head>10 <body>11 <table><tbody><tr><td class=\"wrap\">12 <div>13     <p>看我是否可以居中。<\/p>14     <p>看我是否可以居中。<\/p>15     <p>看我是否可以居中。<\/p>16     <p>看我是否可以居中。<\/p>17     <p>看我是否可以居中。<\/p>18 <\/div>19 <\/td><\/tr><\/tbody><\/table>20 <\/body>21 <\/html><\/pre>   <\/p>   <p> <\/p>   <p>注:因為 td 標(biāo)簽?zāi)J情況下就默認設(shè)置了 vertical-align 為 middle,所以我們不需要顯式地設(shè)置了。<\/p>   <p>效果圖如下:<\/p>   <p> <\/p>   <p><strong>☆垂直居中-父元素高度確定的多行文本(方法二)<\/strong><\/p>   <p>  在 chrome、firefox 及 IE8 以上的瀏覽器下可以設(shè)置塊級元素的 display 為 table-cell,激活 vertical-align 屬性,但注意 IE6、7 并不支持這個樣式。<br \/>html代碼:<\/p>   <p class=\"sycode\">    <pre class='brush:php;toolbar:false;'> 1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta  charset=\"utf-8\"> 5 <title>父元素高度確定的多行文本<\/title> 6 <style> 7 .container{ 8     height:300px; 9     background:#ccc;10     display:table-cell;\/*IE8以上及Chrome、Firefox*\/11     vertical-align:middle;\/*IE8以上及Chrome、Firefox*\/12 }13 <\/style>14 <\/head>15 16 <body>17 <div   id="377j5v51b"   class=\"container\">18     <div>19         <p>看我是否可以居中。<\/p>20         <p>看我是否可以居中。<\/p>21         <p>看我是否可以居中。<\/p>22         <p>看我是否可以居中。<\/p>23         <p>看我是否可以居中。<\/p>24     <\/div>25 <\/div>26 <\/body>27 <\/html><\/pre>   <\/p>   <p>  這種方法的好處是不用添加多余的無意義的標(biāo)簽,但缺點也很明顯,它的兼容性不是很好,不兼容 IE6、7。(效果圖如方法一圖)<\/p>   <p><strong>隱形改變display類型<\/strong><\/p>   <p><strong>☆隱形改變display類型<\/strong><\/p>   <p>  有一個有趣的現(xiàn)象就是當(dāng)為元素(不論之前是什么類型元素,display:none 除外)設(shè)置以下 兩句之一:<br \/>  position : absolute<br \/>  float : left 或 float:right<br \/>  元素會自動變?yōu)橐?nbsp;display:inline-block 的方式顯示,當(dāng)然也可以設(shè)置元素的 width 和 height 了且默認寬度不占滿父元素。<br \/>如下面的代碼,小伙伴們都知道 a 標(biāo)簽是行內(nèi)元素,所以設(shè)置它的 width 是 沒有效果的,但是設(shè)置為 position:absolute 以后,就可以了。<\/p>   <p class=\"sycode\">    <pre class='brush:php;toolbar:false;'> 1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta  charset=\"utf-8\"> 5 <title>隱性改變display類型<\/title> 6 <style> 7 .container a{ 8     position:absolute; 9     width:200px;10     background:#ccc;11     12 }13 <\/style>14 <\/head>15 <body>16 <div   id="377j5v51b"   class=\"container\">17     <a href=\"#\" title=\"\">查看效果<\/a>18 <\/div>19 <\/body>20 <\/html><\/pre>   <\/p>   <p>?<\/p>   <p>效果圖如下:<\/p>   <p>?<\/p>    <p class=\"sycode\"><\/p>  <p class=\"sycode\"><\/p>  <p class=\"sycode\">   <\/p>\n<p class=\"sycode\"><\/p>   <p class=\"sycode\"><\/p>   <p class=\"sycode\">   <\/p>   <p class=\"sycode\"><\/p>   <p class=\"sycode\"><\/p>   "}	</script>
      	
      <meta http-equiv="Cache-Control" content="no-transform" />
      <meta http-equiv="Cache-Control" content="no-siteapp" />
      <script>var V_PATH="/";window.onerror=function(){ return true; };</script>
      </head>
      
      <body data-commit-time="2023-12-28T14:50:12+08:00" class="editor_body body2_2">
      	<link rel="stylesheet" type="text/css" href="/static/csshw/stylehw.css">
      <header>
          <div   id="377j5v51b"   class="head">
              <div   id="377j5v51b"   class="haed_left">
                  <div   id="377j5v51b"   class="haed_logo">
                      <a href="http://www.miracleart.cn/" title="" class="haed_logo_a">
                          <img src="/static/imghw/logo.png" alt="" class="haed_logoimg">
                      </a>
                  </div>
                  <div   id="377j5v51b"   class="head_nav">
                      <div   id="377j5v51b"   class="head_navs">
                          <a href="javascript:;" title="Community" class="head_nava head_nava-template1">Community</a>
                          <div   class="377j5v51b"   id="dropdown-template1" style="display: none;">
                              <div   id="377j5v51b"   class="languagechoose">
                                  <a href="http://www.miracleart.cn/article.html" title="Articles" class="languagechoosea on">Articles</a>
                                  <a href="http://www.miracleart.cn/faq/zt" title="Topics" class="languagechoosea">Topics</a>
                                  <a href="http://www.miracleart.cn/wenda.html" title="Q&A" class="languagechoosea">Q&A</a>
                              </div>
                          </div>
                      </div>
      
                      <div   id="377j5v51b"   class="head_navs">
                          <a href="javascript:;" title="Learn" class="head_nava head_nava-template1_1">Learn</a>
                          <div   class="377j5v51b"   id="dropdown-template1_1" style="display: none;">
                              <div   id="377j5v51b"   class="languagechoose">
                                  <a href="http://www.miracleart.cn/course.html" title="Course" class="languagechoosea on">Course</a>
                                  <a href="http://www.miracleart.cn/dic/" title="Programming Dictionary" class="languagechoosea">Programming Dictionary</a>
                              </div>
                          </div>
                      </div>
      
                      <div   id="377j5v51b"   class="head_navs">
                          <a href="javascript:;" title="Tools Library" class="head_nava head_nava-template1_2">Tools Library</a>
                          <div   class="377j5v51b"   id="dropdown-template1_2" style="display: none;">
                              <div   id="377j5v51b"   class="languagechoose">
                                  <a href="http://www.miracleart.cn/toolset/development-tools" title="Development tools" class="languagechoosea on">Development tools</a>
                                  <a href="http://www.miracleart.cn/toolset/website-source-code" title="Website Source Code" class="languagechoosea">Website Source Code</a>
                                  <a href="http://www.miracleart.cn/toolset/php-libraries" title="PHP Libraries" class="languagechoosea">PHP Libraries</a>
                                  <a href="http://www.miracleart.cn/toolset/js-special-effects" title="JS special effects" class="languagechoosea on">JS special effects</a>
                                  <a href="http://www.miracleart.cn/toolset/website-materials" title="Website Materials" class="languagechoosea on">Website Materials</a>
                                  <a href="http://www.miracleart.cn/toolset/extension-plug-ins" title="Extension plug-ins" class="languagechoosea on">Extension plug-ins</a>
                              </div>
                          </div>
                      </div>
      
                      <div   id="377j5v51b"   class="head_navs">
                          <a href="http://www.miracleart.cn/ai" title="AI Tools" class="head_nava head_nava-template1_3">AI Tools</a>
                      </div>
      
                      <div   id="377j5v51b"   class="head_navs">
                          <a href="javascript:;" title="Leisure" class="head_nava head_nava-template1_3">Leisure</a>
                          <div   class="377j5v51b"   id="dropdown-template1_3" style="display: none;">
                              <div   id="377j5v51b"   class="languagechoose">
                                  <a href="http://www.miracleart.cn/game" title="Game Download" class="languagechoosea on">Game Download</a>
                                  <a href="http://www.miracleart.cn/mobile-game-tutorial/" title="Game Tutorials" class="languagechoosea">Game Tutorials</a>
      
                              </div>
                          </div>
                      </div>
                  </div>
              </div>
                          <div   id="377j5v51b"   class="head_search">
                      <input id="key_words"  onkeydown="if (event.keyCode == 13) searchs('en')" class="search-input" type="text" autocomplete="off" name="keywords" required="required" placeholder="Block,address,transaction,news" value="">
                      <a href="javascript:;" title="search"  onclick="searchs('en')"><img src="/static/imghw/find.png" alt="search"></a>
                  </div>
                      <div   id="377j5v51b"   class="head_right">
                  <div   id="377j5v51b"   class="haed_language">
                      <a href="javascript:;" class="layui-btn haed_language_btn">English<i class="layui-icon layui-icon-triangle-d"></i></a>
                      <div   class="377j5v51b"   id="dropdown-template" style="display: none;">
                          <div   id="377j5v51b"   class="languagechoose">
                                                      <a href="javascript:setlang('zh-cn');" title="簡體中文" class="languagechoosea">簡體中文</a>
                                                      <a href="javascript:;" title="English" class="languagechoosea">English</a>
                                                      <a href="javascript:setlang('zh-tw');" title="繁體中文" class="languagechoosea">繁體中文</a>
                                                      <a href="javascript:setlang('ja');" title="日本語" class="languagechoosea">日本語</a>
                                                      <a href="javascript:setlang('ko');" title="???" class="languagechoosea">???</a>
                                                      <a href="javascript:setlang('ms');" title="Melayu" class="languagechoosea">Melayu</a>
                                                      <a href="javascript:setlang('fr');" title="Fran?ais" class="languagechoosea">Fran?ais</a>
                                                      <a href="javascript:setlang('de');" title="Deutsch" class="languagechoosea">Deutsch</a>
                                                  </div>
                      </div>
                  </div>
                  <span id="377j5v51b"    class="head_right_line"></span>
                                  <div style="display: block;" id="login" class="haed_login ">
                          <a href="javascript:;"  title="Login" class="haed_logina ">Login</a>
                      </div>
                      <div style="display: block;" id="reg" class="head_signup login">
                          <a href="javascript:;"  title="singup" class="head_signupa">singup</a>
                      </div>
                  
              </div>
          </div>
      </header>
      
      	
      	<main>
      		<div   id="377j5v51b"   class="Article_Details_main">
      			<div   id="377j5v51b"   class="Article_Details_main1">
      							<div   id="377j5v51b"   class="Article_Details_main1M">
      					<div   id="377j5v51b"   class="phpgenera_Details_mainL1">
      						<a href="http://www.miracleart.cn/" title="Home"
      							class="phpgenera_Details_mainL1a">Home</a>
      						<img src="/static/imghw/top_right.png" alt="" />
      												<a href="http://www.miracleart.cn/web-designer.html"
      							class="phpgenera_Details_mainL1a">Web Front-end</a>
      						<img src="/static/imghw/top_right.png" alt="" />
      												<a href="http://www.miracleart.cn/div-tutorial.html"
      							class="phpgenera_Details_mainL1a">HTML Tutorial</a>
      						<img src="/static/imghw/top_right.png" alt="" />
      						<span>CSS style design tips (horizontal centering, vertical centering)_html/css_WEB-ITnose</span>
      					</div>
      					
      					<div   id="377j5v51b"   class="Articlelist_txts">
      						<div   id="377j5v51b"   class="Articlelist_txts_info">
      							<h1 class="Articlelist_txts_title">CSS style design tips (horizontal centering, vertical centering)_html/css_WEB-ITnose</h1>
      							<div   id="377j5v51b"   class="Articlelist_txts_info_head">
      								<div   id="377j5v51b"   class="author_info">
      									<a href="http://www.miracleart.cn/member/887227.html"  class="author_avatar">
      									<img class="lazy"  data-src="https://img.php.cn/upload/avatar/000/887/227/63bb7851c9547215.jpg" src="/static/imghw/default1.png" alt="WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB">
      									</a>
      									<div   id="377j5v51b"   class="author_detail">
      																			<a href="http://www.miracleart.cn/member/887227.html" class="author_name">WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB</a>
                                      										</div>
      								</div>
                      			</div>
      							<span id="377j5v51b"    class="Articlelist_txts_time">Jun 24, 2016 am	 11:47 AM</span>
      														
      						</div>
      					</div>
      					<hr />
      					<div   id="377j5v51b"   class="article_main php-article">
      						<div   id="377j5v51b"   class="article-list-left detail-content-wrap content">
      						<ins class="adsbygoogle"
      							style="display:block; text-align:center;"
      							data-ad-layout="in-article"
      							data-ad-format="fluid"
      							data-ad-client="ca-pub-5902227090019525"
      							data-ad-slot="3461856641">
      						</ins>
      						
      
      					<p class="sycode"> </p>
      <p class="sycode"> </p>
      <p><strong>Horizontal center setting </strong></p> <p><strong> (If some phrases are unfamiliar, you can quickly browse through the essays I posted "html common tags", "CSS Summary (Part 1, 2, and 2)", and review it again). </strong></p> <p><strong>☆Horizontal centering setting - inline elements </strong></p> <p> In actual work, we often encounter scenarios where we need to set horizontal centering. Now let’s summarize how to set horizontal centering of. <br>If the set element is an inline element such as text or picture, horizontal centering is achieved by setting text-align:center to the parent element. The following code: <br>html code: </p> <p class="sycode"> <pre class='brush:php;toolbar:false;'> 1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>定寬塊狀元素水平居中</title> 6 <style> 7 div{ 8     border:1px solid red; 9     margin:20px;10 }11 div.txtCenter{12     text-align:center;13 }14 </style>15 </head>16 <body>17 <div class="txtCenter">我是文本,哈哈,我想要在父容器中水平居中顯示。</div>18 </body>19 </html></pre> </p> <p> </p> <p>The rendering is as follows: </p> <p> </p> <p><strong>☆ Horizontal centering setting - fixed-width block element </strong></p> <p> When the element to be set is a block element, text-align: center will not work. There are two situations: fixed-width block Shape elements and block elements of variable width. Let’s take a look at fixed-width block elements first. <br /> Elements that meet the two conditions of fixed width and block can be centered by setting the "left and right margin" value to "auto". Let's look at an example of setting the div block element to be horizontally centered: <br />html code: </p> <p class="sycode"> <pre class='brush:php;toolbar:false;'> 1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 5 <title>定寬塊狀元素水平居中</title> 6 <style> 7 div{ 8     border:1px solid red; 9     width:500px;10     margin:20px auto;11 }12 </style>13 </head>14 <body>15 <div>我是定寬塊狀元素,哈哈,我要水平居中顯示。</div>16 </body>17 </html></pre> </p> <p> </p> <p><br />Note: the " The upper and lower margins can be set at will. </p> <p>The rendering is as follows: </p> <p> </p> <p><strong>☆Horizontal centering setting - variable width block element method (1) </strong></p> <p> In practice At work, we will encounter the need to set the center for "block elements with variable widths", such as pagination navigation on a web page. Because the number of paginations is uncertain, we cannot limit its flexibility by setting the width. <br />There are three methods for centering block elements with variable widths (these three methods are currently used more often): <br />1. Add the table tag <br />2. Set the display; inline method <br />3. Set position:relative and left:50%;<br />Let’s look at the first method first: <br />Step 1: Add a table tag (including <tbody>, <tr>) outside the centered element that needs to be set. ,<td> ). <br />Step 2: Set the "left and right margins to be centered" for this table (this is the same method as the fixed-width block element). <br />For example: <br />html code: </p> <p class="sycode"> <pre class='brush:php;toolbar:false;'> 1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>不定寬塊狀元素水平居中</title> 6 <style> 7 table{ 8     margin:0 auto; 9 }10 ul{list-style:none;margin:0;padding:0;}11 li{float:left;display:inline;margin-right:8px;}12 </style>13 </head>14 <body>15 <div>16 <table>17   <tbody>18     <tr><td>19     <ul>20         <li><a href="#">1</a></li>21         <li><a href="#">2</a></li>22         <li><a href="#">3</a></li>23     </ul>24     </td></tr>25   </tbody>26 </table>27 </div>28 </body>29 </html></pre> </p> <p> </p> <p>The rendering is as follows: </p> <p> </p> <p><strong>☆Horizontal centering setting - variable width block element method (2) </strong></p> <p> The second method: change the display of the block-level element to inline type, and then use text-align:center to achieve centering Effect. The following example: <br />html code: </p> <p class="sycode"> <pre class='brush:php;toolbar:false;'> 1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>不定寬塊狀元素水平居中</title> 6 <style> 7 .container{text-align:center;} 8 .container ul{list-style:none;margin:0;padding:0;display:inline;} 9 .container li{margin-right:8px;display:inline;}10 </style>11 </head>12 13 <body>14 <div class="container">15     <ul>16         <li><a href="#">1</a></li>17         <li><a href="#">2</a></li>18         <li><a href="#">3</a></li>19     </ul>20 </div>21 </body>22 </html></pre> </p> <p>The advantage of this method compared to the first method is that there is no need to add unsemantic tags, which simplifies the nesting depth of tags. But there are also some problems: it changes the display type of the block element to inline, turning it into an inline element, so it loses some functions, such as setting the length value. (The effect picture is as shown in the method one) </p> <p><strong>☆Horizontal centering setting - variable width block element method (3) </strong></p> <p>Method three: By setting float to the parent element, Then set position:relative and left:50% for the parent element, and set position:relative and left:-50% for the child element to achieve horizontal centering. <br />html code: </p> <p class="sycode"> <pre class='brush:php;toolbar:false;'> 1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>不定寬塊狀元素水平居中</title> 6 <style> 7 .container{ 8     float:left; 9     position:relative;10     left:50%11 }12 .container ul{13     list-style:none;14     margin:0;15     padding:0;16     17     position:relative;18     left:-50%;19 }20 .container li{float:left;display:inline;margin-right:8px;}21 </style>22 </head>23 24 <body>25 <div class="container">26     <ul>27         <li><a href="#">1</a></li>28         <li><a href="#">2</a></li>29         <li><a href="#">3</a></li>30     </ul>31 </div>32 </body>33 </html></pre> </p> <p> This method can retain block elements and still display them in the form of display:block. The advantage is that no silent discussion tags are added and no nesting is added. Depth, but its disadvantage is that position:relative is set, which brings certain side effects. These three methods are widely used and each has its own advantages and disadvantages. Which method to choose depends on the specific situation. (The effect picture is as shown in the method one) </p> <p><strong>Vertical centering setting</strong></p> <p><strong>☆Vertical centering - a single line of text with a determined height of the parent element</strong></p> <p> The method of vertically centering a single line of text whose height is determined by the parent element is achieved by setting the height and line-height of the parent element to be consistent. The following code: </p> <p class="sycode"> <pre class='brush:php;toolbar:false;'> 1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>垂直居中</title> 6 <style> 7 .wrap h2{ 8     margin:0; 9     height:100px;10    line-height:100px;11     background:#ccc;12 }13 </style>14 </head>15 <body>16 <div class="wrap">17     <h2>hello,world!</h2>18 </div>19 </body>20 </html></pre> </p> <p> </p> <p>Rendering: </p> <p> </p> <p> </p> <p><strong>☆Vertical Centering - Multi-line text with a certain height of the parent element (Method 1) </strong></p> <p> There are two ways to vertically center multi-line text, pictures, and block elements with a certain height of the parent element: <br /> Method 1: Use insert table (including tbody, tr, td) tags, and set vertical-align: middle. <br /> Speaking of vertical centering, there is an attribute vertical-align in CSS for vertical centering, but this style will only take effect when the parent element is td or th. So we have to insert the table tag again. Let’s take a look at an example: <br />html code: </p>   <p class="sycode">    <pre class='brush:php;toolbar:false;'> 1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta  charset="utf-8"> 5 <title>父元素高度確定的多行文本</title> 6 <style> 7   .wrap{height:300px;background:#ccc} 8 </style> 9 </head>10 <body>11 <table><tbody><tr><td class="wrap">12 <div>13     <p>看我是否可以居中。</p>14     <p>看我是否可以居中。</p>15     <p>看我是否可以居中。</p>16     <p>看我是否可以居中。</p>17     <p>看我是否可以居中。</p>18 </div>19 </td></tr></tbody></table>20 </body>21 </html></pre>   </p>   <p> </p>   <p>注:因為 td 標(biāo)簽?zāi)J情況下就默認設(shè)置了 vertical-align 為 middle,所以我們不需要顯式地設(shè)置了。</p>   <p>效果圖如下:</p>   <p> </p>   <p><strong>☆垂直居中-父元素高度確定的多行文本(方法二)</strong></p>   <p>  在 chrome、firefox 及 IE8 以上的瀏覽器下可以設(shè)置塊級元素的 display 為 table-cell,激活 vertical-align 屬性,但注意 IE6、7 并不支持這個樣式。<br />html代碼:</p>   <p class="sycode">    <pre class='brush:php;toolbar:false;'> 1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta  charset="utf-8"> 5 <title>父元素高度確定的多行文本</title> 6 <style> 7 .container{ 8     height:300px; 9     background:#ccc;10     display:table-cell;/*IE8以上及Chrome、Firefox*/11     vertical-align:middle;/*IE8以上及Chrome、Firefox*/12 }13 </style>14 </head>15 16 <body>17 <div class="container">18     <div>19         <p>看我是否可以居中。</p>20         <p>看我是否可以居中。</p>21         <p>看我是否可以居中。</p>22         <p>看我是否可以居中。</p>23         <p>看我是否可以居中。</p>24     </div>25 </div>26 </body>27 </html></pre>   </p>   <p>  這種方法的好處是不用添加多余的無意義的標(biāo)簽,但缺點也很明顯,它的兼容性不是很好,不兼容 IE6、7。(效果圖如方法一圖)</p>   <p><strong>隱形改變display類型</strong></p>   <p><strong>☆隱形改變display類型</strong></p>   <p>  有一個有趣的現(xiàn)象就是當(dāng)為元素(不論之前是什么類型元素,display:none 除外)設(shè)置以下 兩句之一:<br />  position : absolute<br />  float : left 或 float:right<br />  元素會自動變?yōu)橐?display:inline-block 的方式顯示,當(dāng)然也可以設(shè)置元素的 width 和 height 了且默認寬度不占滿父元素。<br />如下面的代碼,小伙伴們都知道 a 標(biāo)簽是行內(nèi)元素,所以設(shè)置它的 width 是 沒有效果的,但是設(shè)置為 position:absolute 以后,就可以了。</p>   <p class="sycode">    <pre class='brush:php;toolbar:false;'> 1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta  charset="utf-8"> 5 <title>隱性改變display類型</title> 6 <style> 7 .container a{ 8     position:absolute; 9     width:200px;10     background:#ccc;11     12 }13 </style>14 </head>15 <body>16 <div class="container">17     <a href="#" title="">查看效果</a>18 </div>19 </body>20 </html></pre>   </p>   <p>?</p>   <p>效果圖如下:</p>   <p>?</p>    <p class="sycode"></p>  <p class="sycode"></p>  <p class="sycode">   </p>
      <p class="sycode"></p>   <p class="sycode"></p>   <p class="sycode">   </p>   <p class="sycode"></p>   <p class="sycode"></p>   
      
      
      						</div>
      					</div>
      					<div   id="377j5v51b"   class="wzconShengming_sp">
      						<div   id="377j5v51b"   class="bzsmdiv_sp">Statement of this Website</div>
      						<div>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</div>
      					</div>
      				</div>
      
      				<ins class="adsbygoogle"
           style="display:block"
           data-ad-format="autorelaxed"
           data-ad-client="ca-pub-5902227090019525"
           data-ad-slot="2507867629"></ins>
      
      
      
      				<div   id="377j5v51b"   class="AI_ToolDetails_main4sR">
      
      
      				<ins class="adsbygoogle"
              style="display:block"
              data-ad-client="ca-pub-5902227090019525"
              data-ad-slot="3653428331"
              data-ad-format="auto"
              data-full-width-responsive="true"></ins>
          
      
      
      					<!-- <div   id="377j5v51b"   class="phpgenera_Details_mainR4">
      						<div   id="377j5v51b"   class="phpmain1_4R_readrank">
      							<div   id="377j5v51b"   class="phpmain1_4R_readrank_top">
      								<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      									onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      									src="/static/imghw/hotarticle2.png" alt="" />
      								<h2>Hot Article</h2>
      							</div>
      							<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottom">
      															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
      									<a href="http://www.miracleart.cn/faq/1796821119.html" title="Guide: Stellar Blade Save File Location/Save File Lost/Not Saving" class="phpgenera_Details_mainR4_bottom_title">Guide: Stellar Blade Save File Location/Save File Lost/Not Saving</a>
      									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
      										<span>4 weeks ago</span>
      										<span>By DDD</span>
      									</div>
      								</div>
      															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
      									<a href="http://www.miracleart.cn/faq/1796827210.html" title="Oguri Cap Build Guide | A Pretty Derby Musume" class="phpgenera_Details_mainR4_bottom_title">Oguri Cap Build Guide | A Pretty Derby Musume</a>
      									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
      										<span>2 weeks ago</span>
      										<span>By Jack chen</span>
      									</div>
      								</div>
      															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
      									<a href="http://www.miracleart.cn/faq/1796828723.html" title="Agnes Tachyon Build Guide | A Pretty Derby Musume" class="phpgenera_Details_mainR4_bottom_title">Agnes Tachyon Build Guide | A Pretty Derby Musume</a>
      									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
      										<span>2 weeks ago</span>
      										<span>By Jack chen</span>
      									</div>
      								</div>
      															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
      									<a href="http://www.miracleart.cn/faq/1796821436.html" title="Dune: Awakening - Advanced Planetologist Quest Walkthrough" class="phpgenera_Details_mainR4_bottom_title">Dune: Awakening - Advanced Planetologist Quest Walkthrough</a>
      									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
      										<span>4 weeks ago</span>
      										<span>By Jack chen</span>
      									</div>
      								</div>
      															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
      									<a href="http://www.miracleart.cn/faq/1796821278.html" title="Date Everything: Dirk And Harper Relationship Guide" class="phpgenera_Details_mainR4_bottom_title">Date Everything: Dirk And Harper Relationship Guide</a>
      									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
      										<span>4 weeks ago</span>
      										<span>By Jack chen</span>
      									</div>
      								</div>
      														</div>
      							<div   id="377j5v51b"   class="phpgenera_Details_mainR3_more">
      								<a href="http://www.miracleart.cn/article.html">Show More</a>
      							</div>
      						</div>
      					</div> -->
      
      
      											<div   id="377j5v51b"   class="phpgenera_Details_mainR3">
      							<div   id="377j5v51b"   class="phpmain1_4R_readrank">
      								<div   id="377j5v51b"   class="phpmain1_4R_readrank_top">
      									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      										onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      										src="/static/imghw/hottools2.png" alt="" />
      									<h2>Hot AI Tools</h2>
      								</div>
      								<div   id="377j5v51b"   class="phpgenera_Details_mainR3_bottom">
      																		<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
      											<a href="http://www.miracleart.cn/ai/undress-ai-tool" title="Undress AI Tool" class="phpmain_tab2_mids_top_img">
      												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													class="lazy"  data-src="https://img.php.cn/upload/ai_manual/001/246/273/173410641626608.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Undress AI Tool" />
      											</a>
      											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
      												<a href="http://www.miracleart.cn/ai/undress-ai-tool" title="Undress AI Tool" class="phpmain_tab2_mids_title">
      													<h3>Undress AI Tool</h3>
      												</a>
      												<p>Undress images for free</p>
      											</div>
      										</div>
      																		<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
      											<a href="http://www.miracleart.cn/ai/undresserai-undress" title="Undresser.AI Undress" class="phpmain_tab2_mids_top_img">
      												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													class="lazy"  data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411540686492.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Undresser.AI Undress" />
      											</a>
      											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
      												<a href="http://www.miracleart.cn/ai/undresserai-undress" title="Undresser.AI Undress" class="phpmain_tab2_mids_title">
      													<h3>Undresser.AI Undress</h3>
      												</a>
      												<p>AI-powered app for creating realistic nude photos</p>
      											</div>
      										</div>
      																		<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
      											<a href="http://www.miracleart.cn/ai/ai-clothes-remover" title="AI Clothes Remover" class="phpmain_tab2_mids_top_img">
      												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													class="lazy"  data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411552797167.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="AI Clothes Remover" />
      											</a>
      											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
      												<a href="http://www.miracleart.cn/ai/ai-clothes-remover" title="AI Clothes Remover" class="phpmain_tab2_mids_title">
      													<h3>AI Clothes Remover</h3>
      												</a>
      												<p>Online AI tool for removing clothes from photos.</p>
      											</div>
      										</div>
      																		<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
      											<a href="http://www.miracleart.cn/ai/clothoffio" title="Clothoff.io" class="phpmain_tab2_mids_top_img">
      												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													class="lazy"  data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411529149311.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Clothoff.io" />
      											</a>
      											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
      												<a href="http://www.miracleart.cn/ai/clothoffio" title="Clothoff.io" class="phpmain_tab2_mids_title">
      													<h3>Clothoff.io</h3>
      												</a>
      												<p>AI clothes remover</p>
      											</div>
      										</div>
      																		<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
      											<a href="http://www.miracleart.cn/ai/video-swap" title="Video Face Swap" class="phpmain_tab2_mids_top_img">
      												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													class="lazy"  data-src="https://img.php.cn/upload/ai_manual/001/246/273/173414504068133.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Video Face Swap" />
      											</a>
      											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
      												<a href="http://www.miracleart.cn/ai/video-swap" title="Video Face Swap" class="phpmain_tab2_mids_title">
      													<h3>Video Face Swap</h3>
      												</a>
      												<p>Swap faces in any video effortlessly with our completely free AI face swap tool!</p>
      											</div>
      										</div>
      																</div>
      								<div   id="377j5v51b"   class="phpgenera_Details_mainR3_more">
      									<a href="http://www.miracleart.cn/ai">Show More</a>
      								</div>
      							</div>
      						</div>
      					
      
      
      					<div   id="377j5v51b"   class="phpgenera_Details_mainR4">
      						<div   id="377j5v51b"   class="phpmain1_4R_readrank">
      							<div   id="377j5v51b"   class="phpmain1_4R_readrank_top">
      								<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      									onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      									src="/static/imghw/hotarticle2.png" alt="" />
      								<h2>Hot Article</h2>
      							</div>
      							<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottom">
      															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
      									<a href="http://www.miracleart.cn/faq/1796821119.html" title="Guide: Stellar Blade Save File Location/Save File Lost/Not Saving" class="phpgenera_Details_mainR4_bottom_title">Guide: Stellar Blade Save File Location/Save File Lost/Not Saving</a>
      									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
      										<span>4 weeks ago</span>
      										<span>By DDD</span>
      									</div>
      								</div>
      															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
      									<a href="http://www.miracleart.cn/faq/1796827210.html" title="Oguri Cap Build Guide | A Pretty Derby Musume" class="phpgenera_Details_mainR4_bottom_title">Oguri Cap Build Guide | A Pretty Derby Musume</a>
      									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
      										<span>2 weeks ago</span>
      										<span>By Jack chen</span>
      									</div>
      								</div>
      															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
      									<a href="http://www.miracleart.cn/faq/1796828723.html" title="Agnes Tachyon Build Guide | A Pretty Derby Musume" class="phpgenera_Details_mainR4_bottom_title">Agnes Tachyon Build Guide | A Pretty Derby Musume</a>
      									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
      										<span>2 weeks ago</span>
      										<span>By Jack chen</span>
      									</div>
      								</div>
      															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
      									<a href="http://www.miracleart.cn/faq/1796821436.html" title="Dune: Awakening - Advanced Planetologist Quest Walkthrough" class="phpgenera_Details_mainR4_bottom_title">Dune: Awakening - Advanced Planetologist Quest Walkthrough</a>
      									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
      										<span>4 weeks ago</span>
      										<span>By Jack chen</span>
      									</div>
      								</div>
      															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
      									<a href="http://www.miracleart.cn/faq/1796821278.html" title="Date Everything: Dirk And Harper Relationship Guide" class="phpgenera_Details_mainR4_bottom_title">Date Everything: Dirk And Harper Relationship Guide</a>
      									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
      										<span>4 weeks ago</span>
      										<span>By Jack chen</span>
      									</div>
      								</div>
      														</div>
      							<div   id="377j5v51b"   class="phpgenera_Details_mainR3_more">
      								<a href="http://www.miracleart.cn/article.html">Show More</a>
      							</div>
      						</div>
      					</div>
      
      
      											<div   id="377j5v51b"   class="phpgenera_Details_mainR3">
      							<div   id="377j5v51b"   class="phpmain1_4R_readrank">
      								<div   id="377j5v51b"   class="phpmain1_4R_readrank_top">
      									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      										onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      										src="/static/imghw/hottools2.png" alt="" />
      									<h2>Hot Tools</h2>
      								</div>
      								<div   id="377j5v51b"   class="phpgenera_Details_mainR3_bottom">
      																		<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
      											<a href="http://www.miracleart.cn/toolset/development-tools/92" title="Notepad++7.3.1" class="phpmain_tab2_mids_top_img">
      												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													class="lazy"  data-src="https://img.php.cn/upload/manual/000/000/001/58ab96f0f39f7357.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="Notepad++7.3.1" />
      											</a>
      											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
      												<a href="http://www.miracleart.cn/toolset/development-tools/92" title="Notepad++7.3.1" class="phpmain_tab2_mids_title">
      													<h3>Notepad++7.3.1</h3>
      												</a>
      												<p>Easy-to-use and free code editor</p>
      											</div>
      										</div>
      																			<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
      											<a href="http://www.miracleart.cn/toolset/development-tools/93" title="SublimeText3 Chinese version" class="phpmain_tab2_mids_top_img">
      												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													class="lazy"  data-src="https://img.php.cn/upload/manual/000/000/001/58ab97a3baad9677.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="SublimeText3 Chinese version" />
      											</a>
      											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
      												<a href="http://www.miracleart.cn/toolset/development-tools/93" title="SublimeText3 Chinese version" class="phpmain_tab2_mids_title">
      													<h3>SublimeText3 Chinese version</h3>
      												</a>
      												<p>Chinese version, very easy to use</p>
      											</div>
      										</div>
      																			<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
      											<a href="http://www.miracleart.cn/toolset/development-tools/121" title="Zend Studio 13.0.1" class="phpmain_tab2_mids_top_img">
      												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													class="lazy"  data-src="https://img.php.cn/upload/manual/000/000/001/58ab97ecd1ab2670.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="Zend Studio 13.0.1" />
      											</a>
      											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
      												<a href="http://www.miracleart.cn/toolset/development-tools/121" title="Zend Studio 13.0.1" class="phpmain_tab2_mids_title">
      													<h3>Zend Studio 13.0.1</h3>
      												</a>
      												<p>Powerful PHP integrated development environment</p>
      											</div>
      										</div>
      																			<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
      											<a href="http://www.miracleart.cn/toolset/development-tools/469" title="Dreamweaver CS6" class="phpmain_tab2_mids_top_img">
      												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													class="lazy"  data-src="https://img.php.cn/upload/manual/000/000/001/58d0e0fc74683535.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="Dreamweaver CS6" />
      											</a>
      											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
      												<a href="http://www.miracleart.cn/toolset/development-tools/469" title="Dreamweaver CS6" class="phpmain_tab2_mids_title">
      													<h3>Dreamweaver CS6</h3>
      												</a>
      												<p>Visual web development tools</p>
      											</div>
      										</div>
      																			<div   id="377j5v51b"   class="phpmain_tab2_mids_top">
      											<a href="http://www.miracleart.cn/toolset/development-tools/500" title="SublimeText3 Mac version" class="phpmain_tab2_mids_top_img">
      												<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      													class="lazy"  data-src="https://img.php.cn/upload/manual/000/000/001/58d34035e2757995.png?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="SublimeText3 Mac version" />
      											</a>
      											<div   id="377j5v51b"   class="phpmain_tab2_mids_info">
      												<a href="http://www.miracleart.cn/toolset/development-tools/500" title="SublimeText3 Mac version" class="phpmain_tab2_mids_title">
      													<h3>SublimeText3 Mac version</h3>
      												</a>
      												<p>God-level code editing software (SublimeText3)</p>
      											</div>
      										</div>
      																	</div>
      								<div   id="377j5v51b"   class="phpgenera_Details_mainR3_more">
      									<a href="http://www.miracleart.cn/ai">Show More</a>
      								</div>
      							</div>
      						</div>
      										
      
      					
      					<div   id="377j5v51b"   class="phpgenera_Details_mainR4">
      						<div   id="377j5v51b"   class="phpmain1_4R_readrank">
      							<div   id="377j5v51b"   class="phpmain1_4R_readrank_top">
      								<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      									onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      									src="/static/imghw/hotarticle2.png" alt="" />
      								<h2>Hot Topics</h2>
      							</div>
      							<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottom">
      															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
      									<a href="http://www.miracleart.cn/faq/gmailyxdlrkzn" title="Where is the login entrance for gmail email?" class="phpgenera_Details_mainR4_bottom_title">Where is the login entrance for gmail email?</a>
      									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
      										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
      											<img src="/static/imghw/eyess.png" alt="" />
      											<span>8638</span>
      										</div>
      										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
      											<img src="/static/imghw/tiezi.png" alt="" />
      											<span>17</span>
      										</div>
      									</div>
      								</div>
      															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
      									<a href="http://www.miracleart.cn/faq/java-tutorial" title="Java Tutorial" class="phpgenera_Details_mainR4_bottom_title">Java Tutorial</a>
      									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
      										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
      											<img src="/static/imghw/eyess.png" alt="" />
      											<span>1784</span>
      										</div>
      										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
      											<img src="/static/imghw/tiezi.png" alt="" />
      											<span>16</span>
      										</div>
      									</div>
      								</div>
      															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
      									<a href="http://www.miracleart.cn/faq/cakephp-tutor" title="CakePHP Tutorial" class="phpgenera_Details_mainR4_bottom_title">CakePHP Tutorial</a>
      									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
      										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
      											<img src="/static/imghw/eyess.png" alt="" />
      											<span>1729</span>
      										</div>
      										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
      											<img src="/static/imghw/tiezi.png" alt="" />
      											<span>56</span>
      										</div>
      									</div>
      								</div>
      															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
      									<a href="http://www.miracleart.cn/faq/laravel-tutori" title="Laravel Tutorial" class="phpgenera_Details_mainR4_bottom_title">Laravel Tutorial</a>
      									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
      										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
      											<img src="/static/imghw/eyess.png" alt="" />
      											<span>1580</span>
      										</div>
      										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
      											<img src="/static/imghw/tiezi.png" alt="" />
      											<span>28</span>
      										</div>
      									</div>
      								</div>
      															<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms">
      									<a href="http://www.miracleart.cn/faq/php-tutorial" title="PHP Tutorial" class="phpgenera_Details_mainR4_bottom_title">PHP Tutorial</a>
      									<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_info">
      										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
      											<img src="/static/imghw/eyess.png" alt="" />
      											<span>1445</span>
      										</div>
      										<div   id="377j5v51b"   class="phpgenera_Details_mainR4_bottoms_infos">
      											<img src="/static/imghw/tiezi.png" alt="" />
      											<span>31</span>
      										</div>
      									</div>
      								</div>
      														</div>
      							<div   id="377j5v51b"   class="phpgenera_Details_mainR3_more">
      								<a href="http://www.miracleart.cn/faq/zt">Show More</a>
      							</div>
      						</div>
      					</div>
      				</div>
      			</div>
      							<div   id="377j5v51b"   class="Article_Details_main2">
      					<div   id="377j5v51b"   class="phpgenera_Details_mainL4">
      						<div   id="377j5v51b"   class="phpmain1_2_top">
      							<a href="javascript:void(0);" class="phpmain1_2_top_title">Related knowledge<img
      									src="/static/imghw/index2_title2.png" alt="" /></a>
      						</div>
      						<div   id="377j5v51b"   class="phpgenera_Details_mainL4_info">
      
      													<div   id="377j5v51b"   class="phphistorical_Version2_mids">
      								<a href="http://www.miracleart.cn/faq/1796822239.html" title="How do I stay up-to-date with the latest HTML standards and best practices?" class="phphistorical_Version2_mids_img">
      									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      										src="/static/imghw/default1.png" class="lazy"  data-src="https://img.php.cn/upload/article/001/253/068/175037959235285.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="How do I stay up-to-date with the latest HTML standards and best practices?" />
      								</a>
      								<a href="http://www.miracleart.cn/faq/1796822239.html" title="How do I stay up-to-date with the latest HTML standards and best practices?" class="phphistorical_Version2_mids_title">How do I stay up-to-date with the latest HTML standards and best practices?</a>
      								<span id="377j5v51b"    class="Articlelist_txts_time">Jun 20, 2025 am	 08:33 AM</span>
      								<p class="Articlelist_txts_p">The key to keep up with HTML standards and best practices is to do it intentionally rather than follow it blindly. First, follow the summary or update logs of official sources such as WHATWG and W3C, understand new tags (such as) and attributes, and use them as references to solve difficult problems; second, subscribe to trusted web development newsletters and blogs, spend 10-15 minutes a week to browse updates, focus on actual use cases rather than just collecting articles; second, use developer tools and linters such as HTMLHint to optimize the code structure through instant feedback; finally, interact with the developer community, share experiences and learn other people's practical skills, so as to continuously improve HTML skills.</p>
      							</div>
      														<div   id="377j5v51b"   class="phphistorical_Version2_mids">
      								<a href="http://www.miracleart.cn/faq/1796821966.html" title="How do I use the  element to represent the main content of a document?" class="phphistorical_Version2_mids_img">
      									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      										src="/static/imghw/default1.png" class="lazy"  data-src="https://img.php.cn/upload/article/001/253/068/175034575284018.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="How do I use the  element to represent the main content of a document?" />
      								</a>
      								<a href="http://www.miracleart.cn/faq/1796821966.html" title="How do I use the  element to represent the main content of a document?" class="phphistorical_Version2_mids_title">How do I use the  element to represent the main content of a document?</a>
      								<span id="377j5v51b"    class="Articlelist_txts_time">Jun 19, 2025 pm	 11:09 PM</span>
      								<p class="Articlelist_txts_p">The reason for using tags is to improve the semantic structure and accessibility of web pages, make it easier for screen readers and search engines to understand page content, and allow users to quickly jump to core content. Here are the key points: 1. Each page should contain only one element; 2. It should not include content that is repeated across pages (such as sidebars or footers); 3. It can be used in conjunction with ARIA properties to enhance accessibility. Usually located after and before, it is used to wrap unique page content, such as articles, forms or product details, and should be avoided in, or in; to improve accessibility, aria-labeledby or aria-label can be used to clearly identify parts.</p>
      							</div>
      														<div   id="377j5v51b"   class="phphistorical_Version2_mids">
      								<a href="http://www.miracleart.cn/faq/1796821965.html" title="How do I create a basic HTML document?" class="phphistorical_Version2_mids_img">
      									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      										src="/static/imghw/default1.png" class="lazy"  data-src="https://img.php.cn/upload/article/001/253/068/175034527243743.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="How do I create a basic HTML document?" />
      								</a>
      								<a href="http://www.miracleart.cn/faq/1796821965.html" title="How do I create a basic HTML document?" class="phphistorical_Version2_mids_title">How do I create a basic HTML document?</a>
      								<span id="377j5v51b"    class="Articlelist_txts_time">Jun 19, 2025 pm	 11:01 PM</span>
      								<p class="Articlelist_txts_p">To create a basic HTML document, you first need to understand its basic structure and write code in a standard format. 1. Use the declaration document type at the beginning; 2. Use the tag to wrap the entire content; 3. Include and two main parts in it, which are used to store metadata such as titles, style sheet links, etc., and include user-visible content such as titles, paragraphs, pictures and links; 4. Save the file in .html format and open the viewing effect in the browser; 5. Then you can gradually add more elements to enrich the page content. Follow these steps to quickly build a basic web page.</p>
      							</div>
      														<div   id="377j5v51b"   class="phphistorical_Version2_mids">
      								<a href="http://www.miracleart.cn/faq/1796823670.html" title="How do I minimize the size of HTML files?" class="phphistorical_Version2_mids_img">
      									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      										src="/static/imghw/default1.png" class="lazy"  data-src="https://img.php.cn/upload/article/001/253/068/175069761263762.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="How do I minimize the size of HTML files?" />
      								</a>
      								<a href="http://www.miracleart.cn/faq/1796823670.html" title="How do I minimize the size of HTML files?" class="phphistorical_Version2_mids_title">How do I minimize the size of HTML files?</a>
      								<span id="377j5v51b"    class="Articlelist_txts_time">Jun 24, 2025 am	 12:53 AM</span>
      								<p class="Articlelist_txts_p">To reduce the size of HTML files, you need to clean up redundant code, compress content, and optimize structure. 1. Delete unused tags, comments and extra blanks to reduce volume; 2. Move inline CSS and JavaScript to external files and merge multiple scripts or style blocks; 3. Simplify label syntax without affecting parsing, such as omitting optional closed tags or using short attributes; 4. After cleaning, enable server-side compression technologies such as Gzip or Brotli to further reduce the transmission volume. These steps can significantly improve page loading performance without sacrificing functionality.</p>
      							</div>
      														<div   id="377j5v51b"   class="phphistorical_Version2_mids">
      								<a href="http://www.miracleart.cn/faq/1796821968.html" title="How do I create checkboxes in HTML using the  element?" class="phphistorical_Version2_mids_img">
      									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      										src="/static/imghw/default1.png" class="lazy"  data-src="https://img.php.cn/upload/article/001/253/068/175034767289886.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="How do I create checkboxes in HTML using the  element?" />
      								</a>
      								<a href="http://www.miracleart.cn/faq/1796821968.html" title="How do I create checkboxes in HTML using the  element?" class="phphistorical_Version2_mids_title">How do I create checkboxes in HTML using the  element?</a>
      								<span id="377j5v51b"    class="Articlelist_txts_time">Jun 19, 2025 pm	 11:41 PM</span>
      								<p class="Articlelist_txts_p">To create an HTML checkbox, use the type attribute to set the element of the checkbox. 1. The basic structure includes id, name and label tags to ensure that clicking text can switch options; 2. Multiple related check boxes should use the same name but different values, and wrap them with fieldset to improve accessibility; 3. Hide native controls when customizing styles and use CSS to design alternative elements while maintaining the complete functions; 4. Ensure availability, pair labels, support keyboard navigation, and avoid relying on only visual prompts. The above steps can help developers correctly implement checkbox components that have both functional and aesthetics.</p>
      							</div>
      														<div   id="377j5v51b"   class="phphistorical_Version2_mids">
      								<a href="http://www.miracleart.cn/faq/1796823674.html" title="How has HTML evolved over time, and what are the key milestones in its history?" class="phphistorical_Version2_mids_img">
      									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      										src="/static/imghw/default1.png" class="lazy"  data-src="https://img.php.cn/upload/article/001/253/068/175069767173496.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="How has HTML evolved over time, and what are the key milestones in its history?" />
      								</a>
      								<a href="http://www.miracleart.cn/faq/1796823674.html" title="How has HTML evolved over time, and what are the key milestones in its history?" class="phphistorical_Version2_mids_title">How has HTML evolved over time, and what are the key milestones in its history?</a>
      								<span id="377j5v51b"    class="Articlelist_txts_time">Jun 24, 2025 am	 12:54 AM</span>
      								<p class="Articlelist_txts_p">HTMLhasevolvedsignificantlysinceitscreationtomeetthegrowingdemandsofwebdevelopersandusers.Initiallyasimplemarkuplanguageforsharingdocuments,ithasundergonemajorupdates,includingHTML2.0,whichintroducedforms;HTML3.x,whichaddedvisualenhancementsandlayout</p>
      							</div>
      														<div   id="377j5v51b"   class="phphistorical_Version2_mids">
      								<a href="http://www.miracleart.cn/faq/1796824133.html" title="How do I use the  element to represent the footer of a document or section?" class="phphistorical_Version2_mids_img">
      									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      										src="/static/imghw/default1.png" class="lazy"  data-src="https://img.php.cn/upload/article/001/253/068/175078424215034.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="How do I use the  element to represent the footer of a document or section?" />
      								</a>
      								<a href="http://www.miracleart.cn/faq/1796824133.html" title="How do I use the  element to represent the footer of a document or section?" class="phphistorical_Version2_mids_title">How do I use the  element to represent the footer of a document or section?</a>
      								<span id="377j5v51b"    class="Articlelist_txts_time">Jun 25, 2025 am	 12:57 AM</span>
      								<p class="Articlelist_txts_p">It is a semantic tag used in HTML5 to define the bottom of the page or content block, usually including copyright information, contact information or navigation links; it can be placed at the bottom of the page or nested in, etc. tags as the end of the block; when using it, you should pay attention to avoid repeated abuse and irrelevant content.</p>
      							</div>
      														<div   id="377j5v51b"   class="phphistorical_Version2_mids">
      								<a href="http://www.miracleart.cn/faq/1796823682.html" title="How do I use the tabindex attribute to control the tab order of elements?" class="phphistorical_Version2_mids_img">
      									<img onerror="this.onerror=''; this.src='/static/imghw/default1.png'"
      										src="/static/imghw/default1.png" class="lazy"  data-src="https://img.php.cn/upload/article/001/253/068/175069781150026.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="How do I use the tabindex attribute to control the tab order of elements?" />
      								</a>
      								<a href="http://www.miracleart.cn/faq/1796823682.html" title="How do I use the tabindex attribute to control the tab order of elements?" class="phphistorical_Version2_mids_title">How do I use the tabindex attribute to control the tab order of elements?</a>
      								<span id="377j5v51b"    class="Articlelist_txts_time">Jun 24, 2025 am	 12:56 AM</span>
      								<p class="Articlelist_txts_p">ThetabindexattributecontrolshowelementsreceivefocusviatheTabkey,withthreemainvalues:tabindex="0"addsanelementtothenaturaltaborder,tabindex="-1"allowsprogrammaticfocusonly,andtabindex="n"(positivenumber)setsacustomtabbing</p>
      							</div>
      													</div>
      
      													<a href="http://www.miracleart.cn/web-designer.html" class="phpgenera_Details_mainL4_botton">
      								<span>See all articles</span>
      								<img src="/static/imghw/down_right.png" alt="" />
      							</a>
      											</div>
      				</div>
      					</div>
      	</main>
      	<footer>
          <div   id="377j5v51b"   class="footer">
              <div   id="377j5v51b"   class="footertop">
                  <img src="/static/imghw/logo.png" alt="">
                  <p>Public welfare online PHP training,Help PHP learners grow quickly!</p>
              </div>
              <div   id="377j5v51b"   class="footermid">
                  <a href="http://www.miracleart.cn/about/us.html">About us</a>
                  <a href="http://www.miracleart.cn/about/disclaimer.html">Disclaimer</a>
                  <a href="http://www.miracleart.cn/update/article_0_1.html">Sitemap</a>
              </div>
              <div   id="377j5v51b"   class="footerbottom">
                  <p>
                      ? php.cn All rights reserved
                  </p>
              </div>
          </div>
      </footer>
      
      <input type="hidden" id="verifycode" value="/captcha.html">
      
      
      
      
      		<link rel='stylesheet' id='_main-css' href='/static/css/viewer.min.css?2' type='text/css' media='all' />
      	
      	
      	
      	
      	
      
      	
      	
      
      
      
      
      
      
      <footer>
      <div class="friendship-link">
      <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p>
      <a href="http://www.miracleart.cn/" title="国产av日韩一区二区三区精品">国产av日韩一区二区三区精品</a>
      
      <div class="friend-links">
      
      
      </div>
      </div>
      
      </footer>
      
      
      <script>
      (function(){
          var bp = document.createElement('script');
          var curProtocol = window.location.protocol.split(':')[0];
          if (curProtocol === 'https') {
              bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
          }
          else {
              bp.src = 'http://push.zhanzhang.baidu.com/push.js';
          }
          var s = document.getElementsByTagName("script")[0];
          s.parentNode.insertBefore(bp, s);
      })();
      </script>
      </body><div id="6mau0" class="pl_css_ganrao" style="display: none;"><tbody id="6mau0"><tr id="6mau0"><s id="6mau0"></s></tr></tbody><tr id="6mau0"></tr><xmp id="6mau0"><nav id="6mau0"><pre id="6mau0"></pre></nav></xmp><strong id="6mau0"><center id="6mau0"><option id="6mau0"></option></center></strong><samp id="6mau0"></samp><td id="6mau0"></td><tr id="6mau0"></tr><td id="6mau0"></td><fieldset id="6mau0"><delect id="6mau0"><abbr id="6mau0"></abbr></delect></fieldset><kbd id="6mau0"></kbd><s id="6mau0"><pre id="6mau0"><tbody id="6mau0"></tbody></pre></s><option id="6mau0"></option><cite id="6mau0"></cite><del id="6mau0"><nav id="6mau0"><pre id="6mau0"></pre></nav></del><menu id="6mau0"></menu><dd id="6mau0"></dd><object id="6mau0"></object><samp id="6mau0"></samp><small id="6mau0"><samp id="6mau0"><source id="6mau0"></source></samp></small><nav id="6mau0"></nav><delect id="6mau0"></delect><strike id="6mau0"><ul id="6mau0"><table id="6mau0"></table></ul></strike><optgroup id="6mau0"></optgroup><li id="6mau0"></li><button id="6mau0"></button><pre id="6mau0"></pre><center id="6mau0"></center><fieldset id="6mau0"></fieldset><wbr id="6mau0"></wbr><cite id="6mau0"></cite><source id="6mau0"></source><table id="6mau0"></table><cite id="6mau0"></cite><tr id="6mau0"></tr><acronym id="6mau0"></acronym><td id="6mau0"></td><button id="6mau0"></button><source id="6mau0"><dfn id="6mau0"><li id="6mau0"></li></dfn></source><abbr id="6mau0"><s id="6mau0"><acronym id="6mau0"></acronym></s></abbr><cite id="6mau0"></cite><xmp id="6mau0"></xmp><small id="6mau0"></small><th id="6mau0"></th><bdo id="6mau0"></bdo><li id="6mau0"></li><cite id="6mau0"></cite><input id="6mau0"><pre id="6mau0"><dl id="6mau0"></dl></pre></input><acronym id="6mau0"><tbody id="6mau0"><td id="6mau0"></td></tbody></acronym><noframes id="6mau0"><code id="6mau0"><delect id="6mau0"></delect></code></noframes></div>
      
      </html>