Question about CSS selectors

Discussion in 'HTML' started by Jeanne D, Oct 15, 2005.

  1. Jeanne D

    Jeanne D Guest

    This is probably really obvious, but I can't find what I'm looking to
    do in my DHTML and CSS manual.

    I want to have two different selectors specified on one line of type.

    The Great Escape .... by JD

    I wanted the The Great Escape to be in one font and ... by JD in
    another. How do I do that? Thanks much.
    Jeanne D, Oct 15, 2005
    #1
    1. Advertising

  2. Jeanne D

    Jeanne D Guest

    Please disregard my question - I need to familiarize myself with
    positioning. Guess one has to think differently, I'm still in HTML mode.
    Jeanne D, Oct 16, 2005
    #2
    1. Advertising

  3. Jeanne D

    Chris Beall Guest

    Jeanne D wrote:

    > This is probably really obvious, but I can't find what I'm looking to
    > do in my DHTML and CSS manual.
    >
    > I want to have two different selectors specified on one line of type.
    >
    > The Great Escape .... by JD
    >
    > I wanted the The Great Escape to be in one font and ... by JD in
    > another. How do I do that? Thanks much.
    >

    Jeanne,

    Hmmm. This looks like a citation, so you could use something like:

    <cite>The Great Escape <span class="author">.... by JD</span></cite>

    Then, in the CSS:

    cite {
    font-family: whatever1 ;
    }
    ..author {
    font-family: whatever2 ;
    }

    That would apply whatever2 to ANY element of class author. If that's
    too general, you could instead say:

    cite span.author {
    font-family: whatever2 ;
    }

    Which means "apply this style to any <span> of class author that is the
    descendant of (i.e. contained inside) a <cite>".

    The exciting details of CSS selectors can be found at
    http://www.w3.org/TR/CSS21/selector.html. I recommend ingestion of a
    stimulant before reading.

    Chris Beall
    Chris Beall, Oct 16, 2005
    #3
  4. Jeanne D

    dorayme Guest

    > From: "Jeanne D" <>
    >
    > This is probably really obvious, but I can't find what I'm looking to
    > do in my DHTML and CSS manual.
    >
    > I want to have two different selectors specified on one line of type.
    >
    > The Great Escape .... by JD
    >
    > I wanted the The Great Escape to be in one font and ... by JD in
    > another. How do I do that? Thanks much.
    >


    How about something like:

    <div class="whatever1">The Great Escape <span class="whatever2">by
    JD</span></div>


    dorayme
    dorayme, Oct 16, 2005
    #4
  5. Jeanne D

    Andy Dingley Guest

    On 15 Oct 2005 15:01:33 -0700, "Jeanne D" <>
    wrote:

    >I wanted the The Great Escape to be in one font and ... by JD in
    >another. How do I do that?


    <span class="title" >The Great Escape</span> by <span
    class="author" >JD<span>


    Then in the CSS use

    ..title {
    font-family: sans-serif;
    font-size: 110%;
    }
    ..author {
    font-family: serif;
    font-style: oblique;
    }

    Obviously you can use any CSS settings in these rules that you might
    wish.

    And you need a better CSS book (try Lie & Bos)
    Andy Dingley, Oct 16, 2005
    #5
  6. Jeanne D

    JDS Guest

    On Sat, 15 Oct 2005 16:01:04 -0700, Jeanne D wrote:

    > I'm still in HTML mode.


    In a general sense, to mentally transition to HTML+CSS instead of, say
    HTML plus HTML tables for layout, remember that absolutely no layout clues
    go into the HTML. I think the hardest part of *realy* switching from
    using HTML tables for layout is not using HTML for layout AT ALL. A
    really well structured HTML document that uses CSS for layout should look,
    without the CSS applied, like a very plain vanilla HTML page circa 1994.

    --
    JDS |
    | http://www.newtnotes.com
    DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/
    JDS, Oct 16, 2005
    #6
  7. Jeanne D

    Jeanne D Guest

    Thanks Chris - worked great. Thanks for the link too - I've visited
    that site in the past.
    Jeanne D, Oct 16, 2005
    #7
  8. Jeanne D

    Jeanne D Guest

    from: dorayme
    <<How about something like: <div class="whatever1">The Great Escape
    <span class="whatever2">by JD</span></div>>>


    Thank you - I will try this too.
    Jeanne D, Oct 16, 2005
    #8
  9. Jeanne D

    Jeanne D Guest

    Andy writes:
    <And you need a better CSS book (try Lie & Bos) >

    Thanks for the information. I picked up the Zen of CSS design at the
    library, will try to find Lie & Bos.
    Jeanne D, Oct 16, 2005
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt Beckwith

    Class and ID Selectors (CSS question)

    Matt Beckwith, Jul 12, 2003, in forum: HTML
    Replies:
    3
    Views:
    381
    David Dorward
    Jul 13, 2003
  2. Derek Clarkson
    Replies:
    3
    Views:
    379
    Derek Clarkson
    Nov 7, 2003
  3. Nik Coughin

    css - descendant selectors

    Nik Coughin, Jan 28, 2004, in forum: HTML
    Replies:
    2
    Views:
    387
    Alliss
    Jan 29, 2004
  4. Jon Slaughter

    css selectors

    Jon Slaughter, Apr 17, 2007, in forum: HTML
    Replies:
    13
    Views:
    944
    Ben C
    Apr 21, 2007
  5. Nathan Sokalski

    Help With CSS Selectors

    Nathan Sokalski, Mar 24, 2008, in forum: ASP .Net
    Replies:
    5
    Views:
    343
    Just Me
    Mar 24, 2008
Loading...

Share This Page