Javascript basics_Implementation method of marking text
1. Mark content with basic text elements
Let's see the display effect first:
Corresponding HTML code:
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Learn4Font</title></head><body><p> Element b ― <b> I am the example.</b></p><p> Element em ― <em> I am the example.</em></p><p> Element i ― <i> I am the example.</i></p><p> Element s ― <s> I am the example.</s></p><p> Element strong ― <strong> I am the example.</strong></p><p> Element u ― <u> I am the example. example.</u></p><p> Element small ― <small> I am the example.</small></p><p> Element sub ― <sub> I am the example.</sub></p><p> Element sup ― <sup> I am the example.</sup></p></body></html>
Corresponding element habit style:
*Generally means keywords and product names*b{font-weight: bolder;}*Generally means emphasis*em {font-style: italic;}*Generally means foreign words or technical language*i {font-style: italic;}*Generally means inaccurate or correction*s {text-decoration: line-through;}*Generally means important text*strong {font-weight: bolder;}*Generally means adding underscores to text*u {text-decoration: underline;}*Generally means adding small font content*small {font-size: small;}*Generally means adding superscripts and subscripts*sup {vertical-align: sub; font-size: smaller;}sub {vertical-align: super; font-size:smaller;}2. Use language elements
Ruby, rt and rp elements, look at the effect first:
Corresponding code:
<p style=" font-size: 3em;"> <ruby>Chi<rp>(</rp><rt>chī</rt><rp>)</rp></ruby> <ruby>Mei<rp>(</rp><rt>mèi</rt><rp>)</rp></ruby> <ruby>Wǎng</rt><rp>)</rp></ruby> <ruby>Liǎng</rt><rp>)</rp></ruby> <ruby>Liǎng</rt><rp>)</rp></ruby>
3. Use pre-arranged content
The pre element can change the way the browser processes content, preventing the merge of whitespace characters, and allowing the format in the source document to be preserved.
<pre> <code> var fruits = ["apples","oranges","mangoes","cherries"]; for(var i= 0; i < fruits.length; i++){ document.writeln("I like " + fruits[i]); } </code></pre>The above basic Javascript_the implementation method of marking text is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.