css注意小點

來源:互聯網
上載者:User

標籤:height   執行   hid   元素   play   size   參數   splay   ie7   

jq:

1、prepend(參數);//將參數內容前置再某元素內部;

eg:

<div id="div1">奇妙能力歌</div>

$("#div1").prepend("<a href=‘#‘>陳粒</a>");

//得出結果:<div id="div1"><a href=‘#‘>陳粒</a>奇妙能力歌</div>

2、

outerHeight(boolean)

outerHeight(false);//不計算元素的margin值 計算padding和border

outerHeight(true);//計算元素的margin值

3、delay(time);延遲;

eg:$("#div1").delay(300).show();//該元素延遲300ms再執行顯示;

4、設定捲軸動態滑動

$(document).scrollTop();//捲軸高度

$("body").animate({scrollTop : 500px},500);

5、開啟新視窗

window.open("url");

6、同個類名綁定多個事件,用連寫方法

eg:

$("#focus").keydown(function(){

//xx

}).focus(function(){

//xxx

});

7、雪碧背景圖

.icon icon-1
<span class="icon icon-1"></span>
.icon{background:url(‘‘) no-repeate;}
.icon-1{background-position:-24px -100px;}
背景圖顯示不出,
解決:
.icon{background-image:url(‘‘);background-repeate:no-repeate;}
.icon-1{background-position:-24px -100px;}

8、介面中

若<div><a><img /></a><a><img /></a></div>
a標籤裡面有img標籤,img高度為88,但實際上div的高度為92,“幽林空白節點”
解決方案:給img標籤添加vertical-align:middle;或者img{display:block;}a{font-size:0;}

 

相容性:

ie7:要讓overflow:hidden;有效,需要再其父元素加 position:relative;

 

css注意小點

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.