一個初學者的辛酸路程-jQuery

來源:互聯網
上載者:User

標籤:images   color   after   title   highlight   引用   輸入   ted   har   

前言:

主要概要:

1、HTML+CSS補充

2、DOM事件

3、jQuery樣本

 

內容概要:

1、布局

代碼如下

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>Title</title>    <style>        body{            margin:0;        }        .w{            width:980px;            margin:0 auto;            border:1px solid greenyellow;        }    </style></head><body>    <div style="background-color: black;color: white;">        <div class="w">標題</div>    </div>    <div>        <div class="w">內容</div>    </div></body></html>
View Code

效果如下:

 

 2、clear  both的另外一種寫法 (清除浮動)

常規寫法就是如下所示:

<body>    <div style="background-color: greenyellow;">        <div style="width: 200px;height: 200px;border: 1px solid red;float: left;"></div>        <div style="width: 200px;height: 200px;border: 1px solid red;float: left;"></div>        <div style="width: 200px;height: 200px;border: 1px solid red;float: left;"></div>        <div style="width: 200px;height: 200px;border: 1px solid red;float: left;"></div>        <div style="width: 200px;height: 200px;border: 1px solid red;float: left;"></div>        <div style="width: 200px;height: 200px;border: 1px solid red;float: left;"></div>        <div style="clear: both;"></div>    </div></body>

  接著,我們換另外一種寫法

注意:有content才會加標籤,一般都是這麼寫,不能寫display: none

    <style>        .clearfix:after{            content: ‘.‘;            display: block;            clear: both;            visibility: hidden;            height:0;        }    </style>

所有網站這個都會用到。

以後就寫一個公用的CSS,放在引用即可,after是指在這個標籤內容的後面

<link rel="stylesheet" href="commons.css">

 3、頁面配置,拖動瀏覽器如何讓格式不變

第一種方法:

在外面定義一個div給一個固定寬度,如果縮小他會自動出現捲軸。如

寫法如下:

<div style="width: 800px;">
   輸入標籤
</div>

 方法2:@media

    <style>        @media (min-width: 800px){        .item{            width:20%;            float: left;            }        }        @media (max-width: 700px){        .item{            width:50%;            float: left;            }        }    </style>

 

一個初學者的辛酸路程-jQuery

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.