简体   繁体   English

如何使用 css 使字体厚于 900

[英]how to make font thicker then 900 using css

I want to make my font super thick due to the background colour of my friends image that is in the header of the website.由于我朋友图像的背景颜色位于网站的 header 中,我想让我的字体超级粗。 I found this online, but it is not working unfortunately.我在网上找到了这个,但不幸的是它不起作用。 is there any other way to do this?有没有其他方法可以做到这一点?

 h1{ text-shadow: 1px 0 #888888; letter-spacing:1px; font-weight:bold; }
 <h1>MAKE IT BOLD</h1>

this above is not working and keeps it around the same standard thickness I have already.上面的这个不起作用,并保持在我已经拥有的相同标准厚度附近。

please let me know another solutions.请让我知道另一种解决方案。

use text-stroke使用text-stroke

 .box { letter-spacing: 5px; font-size: 30px; font-weight: 900; font-family:sans-serif; }.th { -webkit-text-stroke: 3px; text-stroke: 3px; }
 <div class="box">HELLO WORLD</div> <div class="box th">HELLO WORLD</div>

Or a lot of text-shadow:或者很多文字阴影:

 .box { letter-spacing: 5px; font-size: 30px; font-weight: 900; font-family:sans-serif; }.th { text-shadow:0 0 2px,0 0 2px,0 0 2px,0 0 2px,0 0 2px,0 0 2px,0 0 2px,0 0 2px,0 0 2px,0 0 2px,0 0 2px,0 0 2px,0 0 2px,0 0 2px; }
 <div class="box">HELLO WORLD</div> <div class="box th">HELLO WORLD</div>

Just because why not drop-shadow filter?只是因为为什么不使用投影过滤器?

But forget this answer, text-stroke is the way to go.但是忘记这个答案,文本笔划是 go 的方式。

 h1{ letter-spacing:1px; font-family: "Comic Sans MS", "Comic Sans", cursive; font-weight:bold; filter: drop-shadow(1px 1px 0 #000) drop-shadow(-1px -1px 0 #000) drop-shadow(1px -1px 0 #000) drop-shadow(-1px 1px 0 #000) }
 <h1>NOW THAT'S BOLD</h1>

Another way is by using text-shadow to add on the text另一种方法是使用text-shadow添加文本

 .bold { letter-spacing: 1px; font-size: 1em; font-weight: 900; }.extra-bold { text-shadow: 0px 1px, 1px 0px, 1px 1px; }
 <div class="bold">Make it bold</div> <div class="bold extra-bold ">Make it bold</div>

Consider using SVG filters考虑使用 SVG 过滤器

 h1{ text-shadow: 1px 0 #888888; letter-spacing:1px; font-weight:bold; filter:url(#f1) }
 <h1>MAKE IT BOLD</h1> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="0" height="0" > <defs> <filter id="f1"> <feGaussianBlur in="SourceGraphic" stdDeviation="1" result="blur" > </feGaussianBlur> <feColorMatrix in="blur" type="matrix" values=" 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 29 -1" result="goo" /> <feComposite in="SourceGraphic" in2="goo" operator="atop"/> </filter> </defs> </svg>

The same combination of filters but instead atop operator is used xor operator使用相同的过滤器组合,但使用xor运算符而不是atop运算符

 h1{ text-shadow: 1px 0 #888888; letter-spacing:1px; font-weight:bold; filter:url(#f1) }
 <h1>MAKE IT BOLD</h1> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="0" height="0" > <defs> <filter id="f1"> <feGaussianBlur in="SourceGraphic" stdDeviation="1" result="blur" > </feGaussianBlur> <feColorMatrix in="blur" type="matrix" values=" 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 24 1" result="goo" /> <feComposite in="SourceGraphic" in2="goo" operator="xor"/> </filter> </defs> </svg>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM