1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

What is the most efficient way to select element specific to the H1

Discussion in 'HTML & Website Design' started by ketting00, Jan 6, 2020.

  1. scu8a

    scu8a Greenhorn

    Messages:
    81
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    15
    #21
    Preach on brotha! Those browser wars made my work hell, and that was around the time where I began to question if I wanted to change careers. I wouldn't really use the term "wars" to describe the mess. It's always been a convoluted ...I think protracted clusterf*** is probably a more accurate term.

    I read up on this new <section> tag @deathshadow mentioned and I wholeheartedly agree. This tag does nothing. And if it does do something that I don't know of, who does it help? Does anyone know why this... thing... exists? What we really need is a tag called <trash>, and all the nonsensical screwed up crap is to be nested there. There could be an option added to your browser that lets you toggle between viewing trash and not viewing trash. Example,
    <trash><section><blink>It's time for a seizure!</blink></section></trash>
    HTML:
    .
     
    scu8a, Jan 11, 2020 IP
  2. LewisH95

    LewisH95 Greenhorn

    Messages:
    118
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    23
    #22
    Most likely what you want is just:

    .product-title {
    // styles go here
    }
    When you separate CSS selector elements with a space, that is using a descendant selector. This means that a selector like this:

    div.parent h1 {
    // styles go here
    }
    would target the <h1> element here:

    <div class="parent">
    <h1>Hello!</h1>
    </div>
     
    LewisH95, May 9, 2020 IP
  3. Web_Dev_Chris

    Web_Dev_Chris Well-Known Member

    Messages:
    222
    Likes Received:
    12
    Best Answers:
    1
    Trophy Points:
    105
    #23
    Hello, to answer you question you can target elements that are nested inside other elements so you would:
    To style H1 element inside a element.
    a h1{ }

    Or to target a below:

    <header>
    <nav>
    <a>Test<a/>
    </nav>
    </header>

    header nav a { }
     
    Web_Dev_Chris, May 10, 2020 IP