HTML CSS examples for HTML Tag:span
The span element can apply global attributes to a region of content.
The span Element summary
Item | Value |
---|---|
Element | span |
Local Attributes | None |
Tag Style | Start and end tag |
New in HTML5 | No |
Changes in HTML5 | None |
Style Convention | None |
The following code shows the span element used with the class attribute to apply a CSS style.
Using the span Element
<!DOCTYPE html> <html> <head> <title>Example</title> <style> .fruit {<!--from ww w . j a va 2s.c om--> border: thin solid black; padding: 1px; } </style> </head> <body> I like <span class="fruit">CSS</span> and <span class="fruit">HTML</span> . </body> </html>