Use CSS3 to achieve the text stroke effect. [The effect is here, and the idea is here !], Css3 stroke

Source: Internet
Author: User

Use CSS3 to achieve the text stroke effect. [The effect is here, and the idea is here !], Css3 stroke

As an emerging front-end technology, CSS3 can achieve many complex changes, such as text strokes.

The text-shadow attribute is used here. As the name suggests, it adds a shadow effect to the text. Example:

Html code
  1. Text-shadow: 10px 5px 2px # f60;

Parameter descriptions for each location:

 

Html code
  1. Text-shadow: x displacement y displacement blur color

Where: x displacement and y Displacement Indicate the Offset Value of the Shadow relative to the text, which can be a negative value.

Now, the idea is simple: Make a 1px shadow of zero degree for all four directions.

Statement:

Html code
  1. -Webkit-text-shadow: #000 1px 0 0 0, #000 0 1px 0, #000-1px 0 0 0, #000 0-1px 0;
  2. -Moz-text-shadow: #000 1px 0 0 0, #000 0 1px 0, #000-1px 0 0 0, #000 0-1px 0;
  3. Text-shadow: #000 1px 0 0 0, #000 0 1px 0, #000-1px 0 0, #000 0-1px 0;
  4. * Filter: Glow (Color = #000, Strength = 1 );

This method is applicable to mainstream browsers.

 

In principle, text-shadow supports multi-direction shadow writing, but the cost is too much code!

<! -- EndF -->


CSS div text strokes are compatible with IE6 IE7 IE8 Firefox

<Style type = "text/css">
Body {font-size: 12px; font-family: Arial, Helvetica, sans-serif;
Filter: alpha (style = 1, startY = 0, finishY = 100, startX = 100, finishX = 100 );
Background-color: #666666;
}
. Sizscolor {
Position: absolute;
Padding: 4px;
Filter:
Dropshadow (offx = 1, offy = 0, color = white)
Dropshadow (offx = 0, offy = 1, color = white)
Dropshadow (offx = 0, offy =-1, color = white)
Dropshadow (offx =-1, offy = 0, color = white );
Text-shadow: 0 0 1px # FFF;
}
</Style>
</Head>
<Body>
<Span> filter for ie and css3 for firefox </span>
<Br/>
<Div class = "sizscolor"> Stroke Effect in Chinese </div>
</Body>
</Html>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.