How to Embed a CSS Span Tag

The Cascading Style Sheets (CSS) span tag gives you greater control over the look of your Web page because it enables you to style just the particular elements you want. These elements are the individual portions, such as words or characters, found in your content. For instance, you have the option to apply colors to certain words within a paragraph. Embedding a span tag consists of creating the CSS rule and applying it to the HyperText Markup Language (HTML) code. Launch your computer's text editor program and use the span tag to format your page.

Instructions

    • 1

      Start your text editor program and open the document you want to add CSS to.

    • 2

      Position your cursor before the closing </head> element and type in the following CSS placeholder:

      <style type="text/css">

      <!--

      -->

      </style>

    • 3

      Enter a term of your choosing to name a class or ID, and precede this with the "span" element. For example, the class "boldtext" would appear as "span.boldtext" in the style rule.

    • 4

      Type your CSS declaration (the style you want to create) between a pair of curly brackets. For instance, to create a style rule for the "boldtext" class that applies a bold font, you would type:

      span.boldtext { font-weight: bold; }

    • 5

      Enter <span class=" "> or <span id=" "> before the text you want to style and type a closing </span> tag at the end. Enter the name of your class or ID between the quotation marks of the first element. For example:

      <span class="boldtext">This is bolded text on the page.</span>

    • 6

      Save your document. The span tag is now embedded on your Web page.

Tips & Warnings

  • A class is preceded by a period and styles more than one area on the page, while an ID starts with a number sign and is only applicable to one spot.

Related Searches:

References

Resources

Comments

You May Also Like

  • HTML Span Tutorial

    To begin, create the placeholder for the CSS style rules between the opening and closing "<head></head>" tags. First, embed the "<style>" style...

  • CSS Image Rollover Effect

    Create a generic XHTML document in your text editor as seen in the image. * Include the DOCTYPE Transitional and your encoding...

  • How to Create a CSS Calendar

    Calendars are often used for selecting dates for appointments, airline flights, hotel availability and when to send e-cards. Usually you see calendars...

  • How to Use Div and Span in HTML and CSS

    Div and span elements often confuse people new to HTML and CSS, because they aren't semantically meaningful elements like headings, lists and...

  • How to Insert CSS in Between Body Tags

    Cascading Style Sheet (CSS) code comes in three flavors: external style sheets, embedded style sheets and inline styles. In all but external...

  • How to Open a Web Page Automatically

    Computers are excellent tools for automation. If you can program the computer to do something at a certain time, it will automatically...

  • How to Set a Span Width in CSS

    While many of the commands you create in an HTML or CSS document directly change the way your Web page appears, this...

  • How to Use CSS for Image Rollover

    Open up your HTML file in an editor or create a new one. Place <div> and </div> tags somewhere between the <body>...

  • How to Embed a Page in a DIV Tag

    The div container is a generic block-level element used within HTML (Hypertext Markup Language) to define a division or section within an...

  • How to Create Photo Albums With CSS

    Cascading Style Sheet (CSS) language provides a way to create an interactive photo gallery without a lick of JavaScript programming. Using the...

  • Definition of Font Color CSS

    CSS or cascading style sheets are tools Web designers use to create Web pages. CSS is scripting code that can be used...

  • How to Embed a Date in a Dynamic HTML Text Link

    JavaScript lets you dynamically write text to elements in your Web pages. You can add a date to a link by placing...

  • How to Embed Streaming Radio Code

    Numerous Internet radio stations provide streaming content, a live feed broadcast over the Web, similar to the way an AM or FM...

Related Ads

Featured