這篇文章主要介紹html去掉空格的方法,文中介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們一定要看完!
創(chuàng)新互聯(lián)建站是一家以網(wǎng)絡(luò)技術(shù)公司,為中小企業(yè)提供網(wǎng)站維護(hù)、網(wǎng)站建設(shè)、成都做網(wǎng)站、網(wǎng)站備案、服務(wù)器租用、國際域名空間、軟件開發(fā)、微信小程序開發(fā)等企業(yè)互聯(lián)網(wǎng)相關(guān)業(yè)務(wù),是一家有著豐富的互聯(lián)網(wǎng)運營推廣經(jīng)驗的科技公司,有著多年的網(wǎng)站建站經(jīng)驗,致力于幫助中小企業(yè)在互聯(lián)網(wǎng)讓打出自已的品牌和口碑,讓企業(yè)在互聯(lián)網(wǎng)上打開一個面向全國乃至全球的業(yè)務(wù)窗口:建站聯(lián)系電話:18980820575
html去掉空格的方法:首先打開相應(yīng)的HTML代碼文件;然后通過在父元素上設(shè)置“font-size:0;”樣式即可去除html代碼標(biāo)簽之間換行產(chǎn)生的空格。
本文操作環(huán)境:windows7系統(tǒng)、HTML5&&CSS3版、Dell G3電腦。
如何去除html代碼標(biāo)簽之間換行產(chǎn)生的空格
推薦方法:在父元素上設(shè)置
font-size: 0;
例:
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title> <style> body { margin: 0; padding: 0; } p { height: 41px; border-top: 4px solid red; border-bottom: 1px solid gray; } a { display: inline-block; height: 41px; text-align: center; line-height: 41px; text-decoration: none; padding: 0px 5px; background-color: red; font-size: 14px; font-family: 楷體; } .shouye { margin-left: 200px; } .shouye:hover { background-color: gray; } </style></head><body> <p> <a class="shouye" href="#">設(shè)為首頁</a> <a href="#">手機(jī)新浪網(wǎng)</a> <a href="#">移動客戶端</a> </p></body></html>
效果預(yù)覽:
修改后代碼:
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title> <style> body { margin: 0; padding: 0; } p { font-size: 0;/*關(guān)鍵代碼*/ height: 41px; border-top: 4px solid red; border-bottom: 1px solid gray; } a { display: inline-block; height: 41px; text-align: center; line-height: 41px; text-decoration: none; padding: 0px 5px; background-color: red; font-size: 14px; font-family: 楷體; } .shouye { margin-left: 200px; } .shouye:hover { background-color: gray; } </style></head><body> <p> <a class="shouye" href="#">設(shè)為首頁</a> <a href="#">手機(jī)新浪網(wǎng)</a> <a href="#">移動客戶端</a> </p></body></html>
效果預(yù)覽:
以上是“html去掉空格的方法”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
標(biāo)題名稱:html去掉空格的方法
文章網(wǎng)址:http://jinyejixie.com/article24/gdjcce.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供響應(yīng)式網(wǎng)站、ChatGPT、、手機(jī)網(wǎng)站建設(shè)、網(wǎng)站導(dǎo)航、品牌網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)