[英]Color around the Text in HTML
I needed to show color around the text in my HTML page, I tried border property but it is giving square box around the Text.我需要在我的 HTML 页面中的文本周围显示颜色,我尝试了边框属性,但它在文本周围给出了方框。 How to achieve below requirement如何达到以下要求
Thanks.谢谢。
I would write the code here... But this link http://line25.com/articles/using-css-text-shadow-to-create-cool-text-effects explains it so well. 我会在这里编写代码......但是这个链接http://line25.com/articles/using-css-text-shadow-to-create-cool-text-effects解释得很好。
Example Demo : http://codepen.io/anon/pen/CDsFb 示例演示 : http : //codepen.io/anon/pen/CDsFb
This is actually much better ... 这实际上好多了......
text-shadow: 3px 3px 0 #000,
/* Simulated effect for Firefox and Opera and nice enhancement for WebKit */
-3px -3px 0 #000,
3px -3px 0 #000,
-3px 3px 0 #000,
3px 3px 0 #000;
This will ensure it looks like a proper border you want and not a simple glow around your text. 这将确保它看起来像您想要的正确边框 ,而不是文本周围的简单光晕。
You are looking for text-shadow
CSS property 您正在寻找text-shadow
CSS属性
text-shadow: 0px 0px 3px orange;
http://jsfiddle.net/NGPhL/ http://jsfiddle.net/NGPhL/
http://www.quirksmode.org/css/textshadow.html http://www.quirksmode.org/css/textshadow.html
You may use 你可以用
text-shadow: 0px 0px 4px #1d1dab;
filter: dropshadow(color=#1d1dab, offx=0, offy=0);
You can use the CSS3 text-shadow property . 您可以使用CSS3 text-shadow属性 。 As long the browser supports webkit, this should surfice. 只要浏览器支持webkit,这应该是很好的。
If browser don't support CSS3: 如果浏览器不支持CSS3:
Use can use two text nodes with 17px and 18px font-size (for example) and positioning by CSS first under second (position:absolute, z-index:100, left, top, etc) with different colors. 使用可以使用具有17px和18px字体大小的两个文本节点(例如),并且首先使用不同颜色的CSS(位置:绝对值,z-index:100,左,顶等)进行CSS定位。
Thanks For your suggestions, I found an example to get this requirement here 谢谢你的建议,我找到了一个例子来满足这个要求
http://gazpo.com/2011/02/text-shadow/ 7. Border Around the text http://gazpo.com/2011/02/text-shadow/ 7.文本边框
text-shadow: 0 -4px #00468C,4px 0 #00468C,0 4px #00468C,-4px 0 #00468C,4px -4px #00468C,-4px 4px #00468C,4px 4px #00468C,-4px -4px #00468C;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.