第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

a元素是內(nèi)聯(lián)元素,為什么會(huì)獨(dú)占一行?

http://img1.sycdn.imooc.com//5898563200019f3903620114.jpg<div class="div">

? ? ? ? ? ? <a>:first-child</a>

? ? ? ? ? ? <a>第二個(gè)元素</a>

? ? ? ? ? ? <a>:last-child</a>

? ? ? ? </div> ?

看結(jié)果頁(yè),【:first-child】后還有空位置呀,為什么【第二個(gè)元素】這句話(huà)直接到第二行去了呢


全部代碼:

<!DOCTYPE html>

<html>


<head>

? ? <meta http-equiv="Content-type" content="text/html; charset=utf-8" />

? ? <title></title>

? ? <link rel="stylesheet" href="imooc.css" type="text/css">

? ? <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>

</head>


<body>

? ? <h3>.html()與.text()</h3>

? ? <div class="left first-div">

? ? ? ? <div class="div">

? ? ? ? ? ? <a>:first-child</a>

? ? ? ? ? ? <a>第二個(gè)元素</a>

? ? ? ? ? ? <a>:last-child</a>

? ? ? ? </div> ?

? ? ? ? <div class="div">

? ? ? ? ? ? <a>:first-child</a>

? ? ? ? ? ? <a>第二個(gè)元素</a>

? ? ? ? ? ? <a>:last-child</a>

? ? ? ? </div>

? ? </div>

? ??

? ? <h4>顯示通過(guò)html方法獲取到的內(nèi)容</h4>

? ? <p></p>


? ? <h4>顯示通過(guò)text方法獲取到的內(nèi)容</h4>

? ? <p></p>

? ??

? ??

? ? <script type="text/javascript">

? ? ? ? //通過(guò).text()的回調(diào),獲取原本的內(nèi)容,修改,在重新賦值

? ? ? ? $(".left a:first").text(function(idnex,text){

? ? ? ? ? ? return "增加新的文本內(nèi)容" + text

? ? ? ? })

? ? </script>




? ? <script type="text/javascript">

? ? ? ? //顯示出html方法獲取到的內(nèi)容

? ? ? ? //.html()是整個(gè)html文檔結(jié)構(gòu)

? ? ? ? $('p:first').html( $(".first-div").html() )?

? ? </script>



? ? <script type="text/javascript">

? ? ? ? //顯示出text方法獲取到的內(nèi)容

? ? ? ? //.text()是文本內(nèi)容的合集

? ? ? ? $('p:last').text( $(".first-div").text() )?

? ? </script>



? ? <script type="text/javascript">

? ? ? ? //通過(guò).text()方法替換文本內(nèi)容

? ? ? ? $(".left a:first").?('替換第一個(gè)a元素的內(nèi)容')

? ? </script>



? ? <script type="text/javascript">

? ? ? ? //通過(guò).html()方法替換html結(jié)構(gòu)

? ? ? ? $(".left div:first").?('整個(gè)div的子節(jié)點(diǎn)都被替換了')

? ? </script>





</body>


</html>


正在回答

3 回答

589857c000017a8905000065.jpg

589857c10001f40505000464.jpg

鏈接了一個(gè).css文件 ?a{display:block}

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

利木 提問(wèn)者

啊QWQ感謝!??!不好意思!!我一直在看HTML完全沒(méi)注意到旁邊還有css(我……不做人了)
2017-02-06 回復(fù) 有任何疑惑可以回復(fù)我~
#2

qq_景象_0 回復(fù) 利木 提問(wèn)者

摸摸頭 做編程要仔細(xì)
2017-02-06 回復(fù) 有任何疑惑可以回復(fù)我~
#3

利木 提問(wèn)者 回復(fù) qq_景象_0

嗯?(PД`q。)?
2017-02-06 回復(fù) 有任何疑惑可以回復(fù)我~

http://img1.sycdn.imooc.com//589847da0001211c12820554.jpg我復(fù)制的你的代碼 并沒(méi)有跳行啊

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

利木 提問(wèn)者

你好,傳上圖片了??!就是如圖所示畫(huà)三個(gè)橫線(xiàn)那個(gè)! 或者你可以直接看一下【jQuery基礎(chǔ) (一)—樣式篇3-2】的結(jié)果頁(yè)
2017-02-06 回復(fù) 有任何疑惑可以回復(fù)我~

這段代碼并不會(huì)跳行 你把所有代碼發(fā)上來(lái)

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

利木 提問(wèn)者

你好,已貼上
2017-02-06 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

a元素是內(nèi)聯(lián)元素,為什么會(huì)獨(dú)占一行?

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)