No announcement yet.

New to CSS

  • Filter
  • Time
  • Show
Clear All
new posts

  • New to CSS


    I'm trying to learn CSS and am using a variety of resources including books and the web. This is my first question related to something I've tried to do research to answer but haven't had any specific luck. I've done some tweaking to get familiar with how things work but am hoping for an explanation why.

    In this example I'll include a bit of HTML and CSS code off the CSSZENGARDEN website. I hope this doesn't offend anyone as I'm not in the slightest way trying to claim authorship. They get all the credit.

    <div id="quickSummary">
    <p class="p1"><span>A demonstration of what can be accomplished
    visually through <acronym title="Cascading Style Sheets">CSS</acronym>-based
    design. Select any style sheet from the list to load it into this page.</span></p>
    <p class="p2"><span>Download the sample <a
    title="This page's source HTML code, not to be modified.">html file</a>
    and <a href=""
    title="This page's sample CSS, the file you may modify.">css file</a></span></p>

    #quickSummary {
    margin: 20px 20px 20px 10px;
    width: 160px;
    float: left;
    #quickSummary p {
    font: italic 10pt/22pt georgia;

    My questions:

    If (#quickSummary) is an ID, what does that make (#quickSummary p)?

    In the HTML code you can see <p class="p1"> and <p class="p2"> but nowhere in the style sheet is there any class attribute for p1 or p2 (you have to take my word for that). I've come to assume the relationship comes from the above CSS sample. What are these 'unspecifically named' classes referred to as?

    I've tried reversing the numbers (p1 and p2) and didn't see any noticeable difference. I tried putting them both to the same (P2 p2 or p1 p1) and didn't notice any change. Is this numbering system done just for cleanliness of code or is there a rule associated with this usage that can be simply explained?

    Thank you very much for your assistance in this. I think I'm going about learning how these things work in a good way (tinkering and observation along with a lot of reading) but I have absolutely no one to ask about this. I've been trying to dig into my VB software to learn what makes it tick and this is just one of the directions it has taken me in. Again, thanks,


  • #2
    It's idle class in this design (p1 and p2).
    They are sort of reserved class for those who want to use it (like 175, 176, 177).
    So, in this case they are totally unnecessary.


    • #3
      Originally posted by markv
      What are these 'unspecifically named' classes referred to as?
      The developer might have assumed such a class was necessary and then later realized he could accomplish the same thang through inheritance.


      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.