溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

CSS怎么利用1像素空缺實(shí)現(xiàn)圓角效果

發(fā)布時(shí)間:2021-08-02 16:06:23 來源:億速云 閱讀:155 作者:chen 欄目:web開發(fā)

本篇內(nèi)容主要講解“CSS怎么利用1像素空缺實(shí)現(xiàn)圓角效果”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“CSS怎么利用1像素空缺實(shí)現(xiàn)圓角效果”吧!

這里基于CSS利用1像素空缺來實(shí)現(xiàn)圓角效果,雖然和真正的圓角有一些細(xì)小的差別,但畢竟是用純CSS代碼實(shí)現(xiàn)的,執(zhí)行效率高,沒有用到圖像資源,而且擴(kuò)展性好,代碼復(fù)用性高,演示中包括一個(gè)列表和一個(gè)DIV區(qū)域。

代碼如下:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>CSS利用1像素空缺實(shí)現(xiàn)為類圓角效果</title>
<style type="text/css">
body {padding:20px; font-family:arial; text-align:center;}
p, li {font-size: 12px; line-height:18px;}
h4 {margin-bottom:6px;}
.examplesGoHere {text-align:left; margin:0 auto; }
.letsGiveItAFixedWidthOf200Pixels { width:200px; }
ul {list-style:none;margin-left:0;padding-left:0;margin-top:0;}
ul li {margin-bottom:8px; margin-left:0;padding-left:0; }
.notchedListItems a {
display:block;
border: solid #666;
border-width: 0 1px;
text-decoration: none;
outline:none;
color: #000;
background: #e4e4e4;
}
.notchedListItems a b {
display: block;
position:relative;
top: -1px;
left: 0;
border:solid #666;
border-width:1px 0 0;
font-weight:normal;
}
.notchedListItems a b b {
border-width:0 0 1px;
top: 2px;
padding:1px 6px;
}
.notchedListItems a:hover,
.notchedListItems a:hover b {background:#666;color:white;}
.feature {
border:solid #647aae;
border-width:0 1px;
background:#b0c0e6;
}
.feature div {
position:relative;
top: -1px;
left: 0;
border:solid #647aae;
border-width:1px 0 0;
}
.feature div div {
top: 2px;
border-width:0 0 1px;
padding: .3em .3em .1em;
}
</style>
</head>
<body>
<div class="examplesGoHere letsGiveItAFixedWidthOf200Pixels">
<h4>列表示例:</h4>
<ul class="notchedListItems">
<li><a href="/"><b><b>網(wǎng)站首頁</b></b></a></li>
<li><a href="/jscss/"><b><b>網(wǎng)頁特效</b></b></a></li>
<li><a href="#"><b><b>軟件下載</b></b></a></li>
</ul>
<h4>DIV區(qū)域:</h4>
<div class="feature">
<div>
<div>
<p>這個(gè)程序雖然不復(fù)雜,但拿來就可以用,簡單實(shí)用。
而對于DELPHI愛好者來說,它具有著很方便的報(bào)表模板設(shè)計(jì),
可以打印機(jī)套打,程序使用了Access數(shù)據(jù)庫和ReportBuilder 7.03控件,
運(yùn)行于Delphi 7.0&hellip;&hellip;</p>
</div>
</div>
</div>
<br/>
<ul class="notchedListItems">
<li><a href="#"><b><b>效果還行吧!</b></b></a></li>
</ul>
</div>
</body>
</html>

到此,相信大家對“CSS怎么利用1像素空缺實(shí)現(xiàn)圓角效果”有了更深的了解,不妨來實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

css
AI