慕課網之javascript入門

來源:互聯網
上載者:User

標籤:引號   osi   利用   absolute   設定   html標籤   慕課   javascrip   col   

這是我的第一篇部落格,從今天開始會記錄自己學到的東西,希望自己能學到越來越多。

JavaScript輸出:document.write()四種方式:

1.直接輸出雙引號裡的內容 document.write(" ");

2.輸出變數名,如: var mychar="hello";document.write(mychar);

3.利用加好"+":document.write(mychar+"hello");

4.輸出html標籤,標籤使用雙引號" "括起來:document.write(mychar+"<br/>"); 我剛沒想起來這個,又回去看了一遍,真的是渣渣orz!

 

再追加下CSS布局之寬度或者高度自適應,可以用百分比來設定。

什麼叫自適應呢?就是當你拖動瀏覽器視窗,放大或者縮小,它還是會按照瀏覽器視窗沒有變化前那樣布局。

用position:absolute實現自適應寬度三欄布局:

設計一個三列布局,左邊固定寬度200px,height:400px;右邊固定width:300px,height:400px;中間為自適應(用margin)。這裡如果設定left,right用float會達不到想要的效果。

.left{width:200px;height:400px;background-color:red;position:absolute;top:0;left:0;}

.mid{height:400px;background-color:blue;margin:0 310px 0 210px;}

.right{width:300px;height:400px;background-color:orange;position:absolute;right:0;top:0;}

 

慕課網之javascript入門

相關文章

聯繫我們

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