<mark id="legu9"><tbody id="legu9"><sup id="legu9"></sup></tbody></mark>
<rp id="legu9"><video id="legu9"><dfn id="legu9"></dfn></video></rp>

    1. <track id="legu9"></track><menu id="legu9"><legend id="legu9"></legend></menu>
      <track id="legu9"></track>

    2. <\/body>
      <\/html> <\/p>

        這是XHTML的基本結(jié)構(gòu),將其命名為index.htm,另一個(gè)記事本文檔則命名為css.css。 <\/p>

        下面,我們?cè)?body><\/body>標(biāo)簽對(duì)中寫入DIV的基本結(jié)構(gòu),代碼如下:


        

        <\/div>
        

          

          <\/div>
          

          <\/div>
        <\/div>
        

        <\/div>
      <\/div> <\/p>

      In order to make it easier to read the code in the future, we should add relevant comments. Next, open the css.css file and write the CSS information. The code is as follows:
      \/*Basic information*\/
      body {font:12px Tahoma;margin:0px;text-align:center;background:#FFF;} <\/p>

      \/*Page layer container*\/
      #container {width:100%} <\/p>

      \/*Page header*\/
      #Header {width:800px;margin:0 auto;height:100px;background:#FFCC99} <\/p>

      \/*Page body*\/
      #PageBody {width:800px;margin:0 auto;height:400px;background:#CCFF00} <\/p>

      \/*Bottom of page*\/
      #Footer {width:800px;margin:0 auto;height:50px; background:#00FFFF} <\/p>

      Save the above file and open it with a browser. At this time we can already see the basic structure. This is the frame of the page.
      Instructions on the above CSS (for details, please refer to the CSS2.0 Chinese manual, available for download online): <\/p>

      1. Please develop good comment habits, this is very important; <\/p>

      2. Body is an HTML element. All content on the page should be written within this tag pair, so I won’t say more; <\/p>

      3. Explain the meaning of some commonly used CSS codes:
      font:12px Tahoma;
      Abbreviations are used here, the complete code should be: font-size:12px; font-family:Tahoma; indicating that the font is 12 pixels in size and the font is in Tahoma format; <\/p>

      margin:0px;
      Abbreviations are also used, the full version should be:
      margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px
      or
      margin:0px 0px 0px 0px
      The order is top\/right\/bottom\/left. You can also write it as margin:0 (abbreviation); <\/p>

      The above style description indicates that the top, right, bottom and left margins of the body part are 0 Pixels, if you use auto, the margins will be automatically adjusted,
      ? There are also the following writing methods:
      ? margin:0px auto;
      ? It means that the top and bottom margins are 0px, and the left and right margins are automatically adjusted;
      We The padding attribute that will be used in the future has many similarities with margin. Their parameters are the same,
      , but they have different meanings. Margin is the outer distance, and padding is the inner distance. <\/p>

      Text-align:center
      Text alignment can be set to left, right, or center. Here I set it to center alignment. <\/p>

        background:#FFF
        Set the background color to white. The color is abbreviated here. The complete color should be background:#FFFFFF.
      Background can be used to fill the specified layer with background color and background image. We will use the following format in the future:
      background:#ccc url('bg.gif') top left no-repeat;
      Representation: Use #CCC (grayscale color) to fill the entire layer, use bg.gif as the background image,
         Top left
                                                                                                   ] ]??? of the current layer. Fill the entire layer.
      Top\/right\/left\/bottom\/center
      Used to position the background image, indicating top\/right\/bottom\/left\/center respectively; you can also use
      background:url('bg.gif') 20px 100px;
                                                                     ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? can be filled in\/out Fill \/ Fill along the X axis \/ Fill along the Y axis.

      Height \/ width \/ color <\/p> Represents height (px), width (px), and font color (HTML color system table) respectively.


      4. How to center the page? <\/p> After you save the code, you can see that the entire page is displayed in the center. So what is the reason why the page is displayed in the center?

      It’s because we used the following attributes in #container:
      margin:0 auto;
      According to the previous explanation, you can know that the top and bottom margins are 0, and the left and right margins are automatic, so this layer will Automatically centered.
      If you want the page to be on the left, just cancel the auto value, because it is displayed on the left by default.
      With margin:auto we can easily center the layer automatically.

      5. Here I only introduce these commonly used CSS properties. For others, please refer to the CSS2.0 Chinese manual. <\/p>

      三、頁(yè)面頂部制作(1)

        當(dāng)我們寫好了頁(yè)面大致的DIV結(jié)構(gòu)后,我們就可以開始細(xì)致地對(duì)每一個(gè)部分進(jìn)行制作了。

        在上一章中我們寫入了一些樣式,那些樣式是為了預(yù)覽結(jié)構(gòu)而寫入的,我們把css.css中的樣式全部清除掉,重新寫入以下樣式代碼:
      程序代碼
      \/*基本信息*\/
      body {font:12px Tahoma;margin:0px;text-align:center;background:#FFF;}
      a:link,a:visited {font-size:12px;text-decoration:none;}
      a:hover{}

      \/*頁(yè)面層容器*\/
      #container {width:800px;margin:10px auto}
        樣式說(shuō)明:

        a:link,a:visited {font-size:12px;text-decoration:none;}
        a:hover {}

        這兩項(xiàng)分別是控制頁(yè)面中超鏈接的樣式,具體我就不說(shuō)明了,請(qǐng)大家參閱手冊(cè)。

        #container {width:800px;margin:10px auto}

        指定整個(gè)頁(yè)面的顯示區(qū)域。
        width:800px指定寬度為800像素,這里根據(jù)實(shí)際所需設(shè)定。
        margin:10px auto,則是頁(yè)面上、下邊距為10個(gè)像素,并且居中顯示。
        上一章中我們講過(guò),對(duì)層的margin屬性的左右邊距設(shè)置為auto可以讓層居中顯示。

        接下來(lái),我們開始制作TOP部分,TOP部分包括了LOGO、菜單和Banner,首先我們要做的就是對(duì)設(shè)計(jì)好的圖片進(jìn)行切片,以下是在FW下完成的切片: <\/p>

      ????????我將TOP部分切片為兩部分,第一部分包括了LOGO和一條橫線。由于LOGO圖片并沒有太多的顏色,這里我于是將這一部分保存為GIF格式,調(diào)色板選擇為精確,選擇Alpha透明度,色版為白色(此處顏色應(yīng)與背景色相同),導(dǎo)出為logo.gif,圖像寬度為800px。

        到這里,有的朋友就說(shuō)了,* 為什么要使用GIF格式?使用JPEG不是更好嗎?
        因?yàn)镚IF格式的圖片文件更小,這樣能使頁(yè)面載入的速度更快,當(dāng)然使用此格式之前必須確定圖片并沒有使用太多的顏色,當(dāng)我們使用了GIF格式時(shí),從肉眼上并不能看出圖片有什么太大的變化,因此這是可行的。

        * 接下來(lái)的Banner部分還能使用GIF格式嗎?
        答案是不能,因?yàn)锽anner部分是一個(gè)細(xì)致的圖片,如果使用GIF格式顏色會(huì)有太大的損失,所以必須使用JPEG格式,將文件導(dǎo)出為banner.jpg。

        * 合理的切片是非常之重要的,因?yàn)榍衅姆椒ㄕ_與否決定了CSS書寫的簡(jiǎn)易程度以及頁(yè)面載入速度。

        切好片后,我們還需要對(duì)TOP部分進(jìn)行分析并將DIV結(jié)構(gòu)寫入Header中代碼如下: