treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] Selecting a classless paragraph

  • Is there a way i can target a class-less or id-less tag? specifically a paragraph tag?

  • Yes you should be able to. You can target a paragraph within a certain div or other element, you'll just have to get specific in your css. Let's say you have a div class of "text" and you want to style that paragraph text different. In your css, you can call up:

    .text p {your styles}
    

    Of course this will work with other elements such as section, articles, etc. Hope that helps!

  • yes, but you'd have to give an example b/c the solution will definitely vary based on context.

  • oh god that was stupid... -_- and i got it :P

  • @attilahajzer, it is better not to over specify class such as

    .text p {your styles}
    

    but use instead generic class like:

    .text-something {your styles}
    

    HTML

          <p class="text-something">My text</p>
    

    That way you can reuse that class with other elements if necessary