使用CSS 創建「逆圓」形狀
「逆圓」的概念是指結合實心圓的形狀其反向鏤空創造出獨特的效果。雖然用 CSS 實現這種形狀似乎具有挑戰性,但不使用任何圖像也是可能的。
背景漸變解決方案
一種方法涉及利用 CSS3 徑向背景漸變。此解決方案可讓您在圓圈與其切口之間創建間隙,從而產生更複雜的效果。
CSS:
.inversePair { border: 1px solid black; display: inline-block; position: relative; height: 100px; text-align: center; line-height: 100px; vertical-align: middle; } #a { width: 100px; border-radius: 50px; background: grey; z-index: 1; } #b { width: 200px; /* Adjust margin/padding for desired "gap" */ padding-left: 30px; margin-left: -30px; /* Real borders */ border-left: none; -webkit-border-top-right-radius: 20px; -webkit-border-bottom-right-radius: 20px; -moz-border-radius-topright: 20px; -moz-border-radius-bottomright: 20px; border-top-right-radius: 20px; border-bottom-right-radius: 20px; /* Inverse circle "cut" */ background-image: -moz-radial-gradient( -23px 50%, circle closest-corner, transparent 0, transparent 55px, black 56px, grey 57px ); background-image: -webkit-radial-gradient(-23px 50%, circle closest-corner, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 55px, black 56px, grey 57px); background-image: -ms-radial-gradient(-23px 50%, circle closest-corner, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 55px, black 56px, grey 57px); background-image: -o-radial-gradient(-23px 50%, circle closest-corner, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 55px, black 56px, grey 57px); background-image: radial-gradient(-23px 50%, circle closest-corner, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 55px, black 56px, grey 57px); }
Z-索引解
另一種方法來專注於使用z 索引解
另一種方法來專注於使用z 索引。創建反圓效果。這需要仔細定位元素以獲得所需的結果。
<div>HTML:<p><strong></strong></p> <pre class="brush:php;toolbar:false">.inversePair { border: 1px solid black; background: grey; display: inline-block; position: relative; height: 100px; text-align: center; line-height: 100px; vertical-align: middle; } #a { width: 100px; border-radius: 50px; } #a:before { content: ""; left: -6px; top: -6px; position: absolute; z-index: -1; width: 112px; height: 112px; border-radius: 56px; background-color: white; } #b { width: 200px; z-index: -2; padding-left: 50px; margin-left: -55px; overflow: hidden; -webkit-border-top-right-radius: 20px; -webkit-border-bottom-right-radius: 20px; -moz-border-radius-topright: 20px; -moz-border-radius-bottomright: 20px; border-top-right-radius: 20px; border-bottom-right-radius: 20px; } #b:before { content: ""; left: -58px; top: -7px; position: absolute; width: 114px; height: 114px; border-radius: 57px; background-color: black; }CSS:
以上是如何僅使用 CSS 創建'反圓”形狀?的詳細內容。更多資訊請關注PHP中文網其他相關文章!
陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

前幾天我得到了這個問題。我的第一個想法是:奇怪的問題!特異性是關於選擇者的,而在符號不是選擇器,那麼...無關緊要?

在這篇文章中,我們將使用我構建和部署的電子商務商店演示來進行Netlify,以展示如何為傳入數據製作動態路線。這是一個公平的


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章
R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
1 個月前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
1 個月前By尊渡假赌尊渡假赌尊渡假赌
刺客信條陰影:貝殼謎語解決方案
3 週前ByDDD
Windows 11 KB5054979中的新功能以及如何解決更新問題
2 週前ByDDD
威爾R.E.P.O.有交叉遊戲嗎?
1 個月前By尊渡假赌尊渡假赌尊渡假赌

熱工具

MinGW - Minimalist GNU for Windows
這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。

Dreamweaver CS6
視覺化網頁開發工具

WebStorm Mac版
好用的JavaScript開發工具

ZendStudio 13.5.1 Mac
強大的PHP整合開發環境

記事本++7.3.1
好用且免費的程式碼編輯器