Introduction to CSS span tag usage



 The span tag has been widely used in the HTML design, and the same can continue to be used in the CSS design. The span tag can be used to mark a line element, which is similar to the usage of the DIV block, but the browser will wrap the span tag. The elements that rise up are treated as a line.


Simple grammar

<span style="style design">content to be modified</span>
The text in this example is only wrapped with span tags, so there will be no CSS special effects. If the browser encounters the span tag, if no special syntax is given, it will ignore the span tag and want to have text color or text. the size of the set, you must define the span of CSS syntax, you can specify the span tag id or class and then an additional place to write CSS syntax, you can also directly to the CSS syntax to write inside the span tag, the following are examples of two ways for writing.

1. Set id and write CSS syntax externally
<style type="text/css">
<!--
 #test{ color: red; }
-->
</style>
<span id="test">這裡是紅色</span>
Rendering like this is red

Second, CSS syntax directly written in the span tag
<span style="color:red;">This is red</span>
The rendering effect is also the same. " Here is red. " The

above is a simple application of the span tag in CSS. You can also try to write it!

Post a Comment

0 Comments