国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 開(kāi)發(fā) > CSS > 正文

利用HTML+CSS制作一個(gè)暖藍(lán)大白

2020-03-24 17:03:49
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
還記得《超能陸戰(zhàn)隊(duì)》里的“暖男”大白么?是不是很想擁有一個(gè)?我們就利用HTML和CSS來(lái)打造一個(gè)自己的“大白”吧!

最終的成果是這樣滴,是不是萌萌噠……

PS:您最好對(duì) HTML 和 CSS 有一定的了解,但如果你是小白也沒(méi)關(guān)系,小白見(jiàn)「大白」也是可以的!

一、準(zhǔn)備工作

進(jìn)入到 /home/shiyanlou/ 目錄下,新建空白文檔:

命名為 Baymax.html (其它名字也可以,但后綴名必須是 .html):

使用 gedit 打開(kāi),準(zhǔn)備編輯代碼:

二、編寫(xiě) HTML

填寫(xiě)以下代碼:

/span html  head meta charset= utf-8 title Baymaxtitle head body  p id= baymax  p id= head  p id= eye p  p id= eye2 p  p id= mouth p  p id= torso  p id= heart p  p id= belly  p id= cover p  p id= left-arm  p id= l-bigfinger p  p id= l-smallfinger p  p id= right-arm  p id= r-bigfinger p  p id= r-smallfinger p  p id= left-leg p  p id= right-leg p body html 

三、添加 CSS 樣式

我們已經(jīng)使用 HTML 定義好「大白」的各個(gè)元素,現(xiàn)在就需要利用到 CSS 來(lái)繪制它的樣式外表。

由于「大白」是白色的,為了更容易辨識(shí),我們把背景設(shè)為深色。

然后首先是頭部:

body {  background: #595959; #baymax{  /*設(shè)置為 居中*/ margin: 0 auto;  /*高度*/ height: 600px;  /*隱藏溢出*/ overflow: hidden; #head{  height: 64px;  width: 100px;  /*以百分比定義圓角的形狀*/ border-radius: 50%;  /*背景*/ background: #fff;  margin: 0 auto;  margin-bottom: -20px;  /*設(shè)置下邊框的樣式*/ border-bottom: 5px solid #e0e0e0;  /*屬性設(shè)置元素的堆疊順序; 擁有更高堆疊順序的元素總是會(huì)處于堆疊順序較低的元素的前面*/ z-index: 100;  /*生成相對(duì)定位的元素*/ position: relative; }

效果預(yù)覽:


趕緊再來(lái)添加眼睛和嘴吧!

#eye, #eye2{  width: 11px;  height: 13px;  background: #282828;  border-radius: 50%;  position: relative;  top: 30px;  left: 27px;  /*旋轉(zhuǎn)該元素*/ transform: rotate(8deg); #eye2{  /*使其旋轉(zhuǎn)對(duì)稱(chēng)*/ transform: rotate(-8deg);  left: 69px; top: 17px; #mouth{  width: 38px;  height: 1.5px;  background: #282828;  position: relative;  left: 34px;  top: 10px; }

一個(gè) mini 的「大白」,雛形初現(xiàn):


接下來(lái)是軀干和腹部:

#torso, #belly{  margin: 0 auto;  height: 200px;  width: 180px;  background: #fff;  border-radius: 47%;  /*設(shè)置邊框*/ border: 5px solid #e0e0e0;  border-top: none;  z-index: 1; #belly{  height: 300px;  width: 245px;  margin-top: -140px;  z-index: 5; #cover{  width: 190px;  background: #fff;  height: 150px;  margin: 0 auto;  position: relative;  top: -20px;  border-radius: 50%; }

賦予「大白」象征生命的心臟:

#heart{  width:25px;  height:25px;  border-radius:50%;  position:relative;  /*向邊框四周添加陰影效果*/ box-shadow:2px 5px 2px #ccc inset;  rightright:-115px;  top:40px;  z-index:111;  border:1px solid #ccc; }

現(xiàn)在的「大白」是這個(gè)樣子的了:

還沒(méi)有手和腳,怪萌怪萌的...「大白」需要溫暖的手臂:

#left-arm, #right-arm{  height: 270px;  width: 120px;  border-radius: 50%;  background: #fff;  margin: 0 auto;  position: relative;  top: -350px;  left: -100px;  transform: rotate(20deg);  z-index: -1; #right-arm{  transform: rotate(-20deg);  left: 100px;  top: -620px; }

還沒(méi)有手指頭呢:

#l-bigfinger, #r-bigfinger{  height: 50px;  width: 20px;  border-radius: 50%;  background: #fff;  position: relative;  top: 250px;  left: 50px;  transform: rotate(-50deg); #r-bigfinger{  left: 50px;  transform: rotate(50deg); #l-smallfinger, #r-smallfinger{  height: 35px;  width: 15px;  border-radius: 50%;  background: #fff;  position: relative;  top: 195px;  left: 66px;  transform: rotate(-40deg); #r-smallfinger{  background: #fff;  transform: rotate(40deg);  top: 195px;  left: 37px; }

有點(diǎn)意思了:

迫不及待要給「大白」加上腿了吧:

#left-leg, #right-leg{  height: 170px;  width: 90px;  border-radius: 40% 30% 10px 45%;  background: #fff;  position: relative;  top: -640px;  left: -45px;  transform: rotate(-1deg);  z-index: -2;  margin: 0 auto; #right-leg{  background: #fff;  border-radius:30% 40% 45% 10px;  margin: 0 auto;  top: -810px;  left: 50px;  transform: rotate(1deg); }

duang~ duang~ duang~ 特技完成!

屬于你的暖男大白來(lái)到了你的身邊,是不是特有安全感哦!

【相關(guān)推薦】

1. 特別推薦:“php程序員工具箱”V0.1版本下載

2. 免費(fèi)html在線視頻教程

3. VeVb.com原創(chuàng)html5視頻教程

以上就是利用HTML+CSS制作一個(gè)暖藍(lán)大白的詳細(xì)內(nèi)容,html教程

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 九寨沟县| 辉南县| 巩义市| 延吉市| 南康市| 二手房| 梅州市| 尼勒克县| 达日县| 边坝县| 焦作市| 台东市| 淮阳县| 巴东县| 五常市| 大连市| 游戏| 湄潭县| 柏乡县| 萨嘎县| 仁怀市| 苗栗县| 神农架林区| 于都县| 岐山县| 合作市| 桦川县| 揭西县| 青川县| 田林县| 莒南县| 乐昌市| 东丽区| 四子王旗| 三亚市| 保靖县| 夏河县| 融水| 普洱| 平潭县| 泰来县|