DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Applying Styles To Selected Contents Via CSS

  1. #1
    Join Date
    Oct 2004

    Question Applying Styles To Selected Contents Via CSS

    Hi everyone,

    I have this rather silly question which i am not able to do via CSS.

    When i use the font tags i am able to apply the font to a selected content say in a particular paragraph, but i don't seem to be able to do this in CSS. Am i missing something.

    A simple example of how to apply any font to selected content in a paragraph using CSS would really be helpful.

    Any help is greatly appreciated

    Thank You

    Yours Sincerely

    Richard West
    What type of softwares do you like and what would you pay for it?

  2. #2
    Join Date
    Dec 2003
    San Diego
    How you implement styles depends on whether you use remote styles, local styles or inline styles. I've included some samples and a link to a tutorial.

    Remote styles would be a .css file that include all your style declarations and you would include it in your files with the <LINK> tag.

    In your .css file:
    .test {
        font-weight:bold; color:#336699; font-size:18px;
    In your Web page:
    <div class="test">Some Text Here</div>
    Local styles would be placing your style declarations in between <style> tags that you would place within your <head> tags.

    In your "style" tags in your Web page:
    .test {
        font-weight:bold; color:#336699; font-size:18px;
    In your Web page content:
    <div class="test">Some Text Here</div>
    Inline styles would be adding the "style" attribute inside any given HTML tag.

    <h1 style="font-weight:bolder; color:#990000">Your Header Text</h1>

    CSS Tutorial

    Good luck,
    Michael Sanchez
    Managing Technical Editor
    Forum Moderator

Similar Threads

  1. Replies: 5
    Last Post: 05-27-2008, 11:17 AM
  2. Replies: 1
    Last Post: 03-08-2006, 01:46 PM
  3. Replies: 1
    Last Post: 01-07-2006, 01:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center