Home  >  Article  >  Web Front-end  >  css3 如何实现圆边框的渐变? 如图

css3 如何实现圆边框的渐变? 如图

WBOY
WBOYOriginal
2016-06-07 08:44:052269browse

回复内容:

<code class="language-css"><span class="o"><span class="nt">DOCTYPE</span> <span class="nt">html</span><span class="o">></span>
<span class="o"><span class="nt">html</span><span class="o">></span>
<span class="o"><span class="nt">head</span><span class="o">></span>
	<span class="o"><span class="nt">meta</span> <span class="nt">charset</span><span class="o">=</span><span class="s2">"utf-8"</span> <span class="o">/></span>
	<span class="o"><span class="nt">style</span><span class="o">></span>
		<span class="nt">div</span> <span class="p">{</span> <span class="k">width</span><span class="o">:</span><span class="m">100px</span><span class="p">;</span> <span class="k">height</span><span class="o">:</span><span class="m">100px</span><span class="p">;</span> <span class="o">-</span><span class="n">webkit</span><span class="o">-</span><span class="n">transform</span><span class="o">:</span><span class="n">rotate</span><span class="p">(</span><span class="m">90</span><span class="n">deg</span><span class="p">);}</span>
		<span class="nt">div</span><span class="nd">:before</span> <span class="p">{</span><span class="k">content</span><span class="o">:</span><span class="s2">""</span><span class="p">;</span> <span class="k">display</span><span class="o">:</span><span class="k">block</span><span class="p">;</span> <span class="k">width</span><span class="o">:</span><span class="m">100px</span><span class="p">;</span><span class="k">height</span><span class="o">:</span><span class="m">50px</span><span class="p">;</span> <span class="k">margin-top</span><span class="o">:</span><span class="m">10px</span><span class="p">;</span> <span class="k">padding</span><span class="o">:</span><span class="m">10px</span><span class="p">;</span> <span class="k">padding-bottom</span><span class="o">:</span><span class="m">0</span><span class="p">;</span> <span class="n">box</span><span class="o">-</span><span class="n">sizing</span><span class="o">:</span><span class="k">border</span><span class="o">-</span><span class="n">box</span><span class="p">;</span>
			<span class="k">border-top</span><span class="o">-</span><span class="k">left</span><span class="o">-</span><span class="n">radius</span><span class="o">:</span><span class="m">50px</span><span class="p">;</span>
			<span class="k">border-top</span><span class="o">-</span><span class="k">right</span><span class="o">-</span><span class="n">radius</span><span class="o">:</span><span class="m">50px</span><span class="p">;</span>
			<span class="k">background</span><span class="o">:-</span><span class="n">webkit</span><span class="o">-</span><span class="n">gradient</span><span class="p">(</span>
				<span class="n">linear</span><span class="o">,</span>
				<span class="k">left</span> <span class="k">top</span><span class="o">,</span>
				<span class="k">right</span> <span class="k">top</span><span class="o">,</span>
				<span class="k">color</span><span class="o">-</span><span class="n">stop</span><span class="p">(</span><span class="m">0</span><span class="o">,</span><span class="m">#fff</span><span class="p">)</span><span class="o">,</span>
				<span class="k">color</span><span class="o">-</span><span class="n">stop</span><span class="p">(</span><span class="m">1</span><span class="o">,</span><span class="m">#fff</span><span class="p">)</span>
			<span class="p">)</span><span class="o">,-</span><span class="n">webkit</span><span class="o">-</span><span class="n">gradient</span><span class="p">(</span>
				<span class="n">linear</span><span class="o">,</span>
				<span class="k">left</span> <span class="k">top</span><span class="o">,</span>
				<span class="k">right</span> <span class="k">top</span><span class="o">,</span>
				<span class="k">color</span><span class="o">-</span><span class="n">stop</span><span class="p">(</span><span class="m">0</span><span class="o">,</span><span class="m">#077df8</span><span class="p">)</span><span class="o">,</span>
				<span class="k">color</span><span class="o">-</span><span class="n">stop</span><span class="p">(</span><span class="m">1</span><span class="o">,</span><span class="m">#74baff</span><span class="p">)</span>
			<span class="p">);</span>
			<span class="k">background</span><span class="o">-</span><span class="k">clip</span><span class="o">:</span><span class="k">content</span><span class="o">-</span><span class="n">box</span><span class="o">,</span><span class="k">padding</span><span class="o">-</span><span class="n">box</span><span class="p">;</span>
		<span class="p">}</span>
		<span class="nt">div</span><span class="nd">:after</span> <span class="p">{</span><span class="k">content</span><span class="o">:</span><span class="s2">""</span><span class="p">;</span> <span class="k">display</span><span class="o">:</span><span class="k">block</span><span class="p">;</span> <span class="k">width</span><span class="o">:</span><span class="m">100px</span><span class="p">;</span><span class="k">height</span><span class="o">:</span><span class="m">50px</span><span class="p">;</span> <span class="k">padding</span><span class="o">:</span><span class="m">10px</span><span class="p">;</span> <span class="k">padding-top</span><span class="o">:</span><span class="m">0</span><span class="p">;</span> <span class="n">box</span><span class="o">-</span><span class="n">sizing</span><span class="o">:</span><span class="k">border</span><span class="o">-</span><span class="n">box</span><span class="p">;</span>
			<span class="k">border-bottom</span><span class="o">-</span><span class="k">left</span><span class="o">-</span><span class="n">radius</span><span class="o">:</span><span class="m">50px</span><span class="p">;</span>
			<span class="k">border-bottom</span><span class="o">-</span><span class="k">right</span><span class="o">-</span><span class="n">radius</span><span class="o">:</span><span class="m">50px</span><span class="p">;</span>
			<span class="k">background</span><span class="o">:-</span><span class="n">webkit</span><span class="o">-</span><span class="n">gradient</span><span class="p">(</span>
				<span class="n">linear</span><span class="o">,</span>
				<span class="k">left</span> <span class="k">top</span><span class="o">,</span>
				<span class="k">right</span> <span class="k">top</span><span class="o">,</span>
				<span class="k">color</span><span class="o">-</span><span class="n">stop</span><span class="p">(</span><span class="m">0</span><span class="o">,</span><span class="m">#fff</span><span class="p">)</span><span class="o">,</span>
				<span class="k">color</span><span class="o">-</span><span class="n">stop</span><span class="p">(</span><span class="m">1</span><span class="o">,</span><span class="m">#fff</span><span class="p">)</span>
			<span class="p">)</span><span class="o">,-</span><span class="n">webkit</span><span class="o">-</span><span class="n">gradient</span><span class="p">(</span>
				<span class="n">linear</span><span class="o">,</span>
				<span class="k">left</span> <span class="k">top</span><span class="o">,</span>
				<span class="k">right</span> <span class="k">top</span><span class="o">,</span>
				<span class="k">color</span><span class="o">-</span><span class="n">stop</span><span class="p">(</span><span class="m">0</span><span class="o">,</span><span class="m">#fff</span><span class="p">)</span><span class="o">,</span>
				<span class="k">color</span><span class="o">-</span><span class="n">stop</span><span class="p">(</span><span class="m">1</span><span class="o">,</span><span class="m">#74baff</span><span class="p">)</span>
			<span class="p">);</span>
			<span class="k">background</span><span class="o">-</span><span class="k">clip</span><span class="o">:</span><span class="k">content</span><span class="o">-</span><span class="n">box</span><span class="o">,</span><span class="k">padding</span><span class="o">-</span><span class="n">box</span><span class="p">;</span>
		<span class="p">}</span>
	<span class="o"></span><span class="nt">style</span><span class="o">></span>
<span class="o"></span><span class="nt">head</span><span class="o">></span>
<span class="o"><span class="nt">body</span><span class="o">></span>
	<span class="o"><span class="nt">div</span><span class="o">></span><span class="nt">div</span><span class="o">></span>
<span class="o"></span><span class="nt">body</span><span class="o">></span>
<span class="o"></span><span class="nt">html</span><span class="o">></span>
</span></span></span></span></span></span></span></code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn