Results 1 to 12 of 12

Thread: [RESOLVED] Visual difference

  1. #1

    Thread Starter
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Resolved [RESOLVED] Visual difference

    Hi,

    What is the visual difference between:

    In the CSS file:
    Code:
    p:first-letter {font-size: 14pt; font-style: italic;}
    and

    Code:
    p.first:first-letter {font-size: 14pt; font-style: italic;}
    Below is the code in the body of the html page:

    Code:
    <p> Joe's Fruit and Vegetables started out as a traditional 
              store selling store selling fruit and veg along with other commodity 
              items such as milk, soft drinks and sweets etc. Joe's has been in business 
              for 27 years and has reputation for the quality of their goods.</p>
    Pictures would be good to help explain this to me.

    Thanks

    NW

  2. #2
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: Visual difference

    Simply it is about use of class as a selector in CSS. In other words, on your first CSS code effect will gives for the body content,

    Code:
    <p> Joe's Fruit and Vegetables started out as a traditional 
              store selling store selling fruit and veg along with other commodity 
              items such as milk, soft drinks and sweets etc. Joe's has been in business 
              for 27 years and has reputation for the quality of their goods.</p>
    For second CSS code wont give any effect until you change the above code as follows,

    Code:
    <p class="first"> Joe's Fruit and Vegetables started out as a traditional 
              store selling store selling fruit and veg along with other commodity 
              items such as milk, soft drinks and sweets etc. Joe's has been in business 
              for 27 years and has reputation for the quality of their goods.</p>
    And also you are in wrong forum. On the HTML, CSS etc forum you can found more details. Administrator should move this later.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  3. #3

    Thread Starter
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Visual difference

    Quote Originally Posted by eranga262154
    [COLOR="DarkGreen"]Simply it is about use of class as a selector in CSS. In other words, on your first CSS code effect will gives for the body content,
    Yeah, I have read that but when I test both codes they both appear to give the same result on the page! Attached is the result of using the following code:

    html:
    Code:
      <p class="first"> Joe's Fruit and Vegetables started out as a traditional 
              store selling store selling fruit and veg along with other commodity 
              items such as milk, soft drinks and sweets etc. Joe's has been in business 
              for 27 years and has reputation for the quality of their goods.</p>
    css:
    Code:
    p.first:first-letter {font-size: 14pt; font-style: italic;}
    However, when I used the other code:
    Code:
     <p> Joe's Fruit and Vegetables started out as a traditional 
              store selling store selling fruit and veg along with other commodity 
              items such as milk, soft drinks and sweets etc. Joe's has been in business 
              for 27 years and has reputation for the quality of their goods.</p>
    CSS:
    Code:
    p:first-letter {font-size: 14pt; font-style: italic;}
    I can't tell the difference in the result! I think maybe I am coding it incorrectly!
    Attached Images Attached Images  
    Last edited by Nightwalker83; Oct 15th, 2007 at 08:12 AM.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Visual difference

    Moved At OP's request

  5. #5

    Thread Starter
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Visual difference

    I hope I put the correct code? (in my last post).
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  6. #6
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: Visual difference

    It is 100% correct. You should get the same output.

    I'll explain it in this way. First thing you have to make sure is first-letter is a CSS style attribute.

    If you use the code as follows,

    Code:
    <p class="first"> Joe's Fruit and Vegetables started out as a traditional 
              store selling store selling fruit and veg along with other commodity 
              items such as milk, soft drinks and sweets etc. Joe's has been in business 
              for 27 years and has reputation for the quality of their goods.</p>
    it use the class named first from the CSS code,

    Code:
    p.first:first-letter {font-size: 14pt; font-style: italic;}
    Because there you have create a class in p tag as p.first If you don't use class="first" it is still direct to same CSS code. Because it works on <p></p> tags and p CSS code.

    If you use the code as follows,

    Code:
    <p> Joe's Fruit and Vegetables started out as a traditional 
              store selling store selling fruit and veg along with other commodity 
              items such as milk, soft drinks and sweets etc. Joe's has been in business 
              for 27 years and has reputation for the quality of their goods.</p>
    it directed to the other CSS code. Because there is not use a class. That time <p></p> tags used the following CSS code,

    Code:
    p:first-letter {font-size: 14pt; font-style: italic;}
    You don't get the difference here. It is true. Check both CSS code. Both are same, do the first appear as italic. Try to change one of them, may be as follows,

    Code:
    p:first-letter {font-size: 25pt; font-style: bold;}
    with,

    Code:
    <p> Joe's Fruit and Vegetables started out as a traditional 
              store selling store selling fruit and veg along with other commodity 
              items such as milk, soft drinks and sweets etc. Joe's has been in business 
              for 27 years and has reputation for the quality of their goods.</p>
    you can see the difference.

    May be this link can be helpful to you.

    Last edited by eranga262154; Oct 15th, 2007 at 11:50 PM. Reason: Adding more
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  7. #7

    Thread Starter
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Visual difference

    Thanks!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  8. #8
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: [RESOLVED] Visual difference

    You are welcome. So it is clear now. The thing is CSS has such resources in bunches. Some of them are like same but the way it works are difference.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  9. #9

    Thread Starter
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: [RESOLVED] Visual difference

    Quote Originally Posted by eranga262154
    You are welcome. So it is clear now. The thing is CSS has such resources in bunches. Some of them are like same but the way it works are difference.
    Yeah, the difference between is clear now!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  10. #10
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: [RESOLVED] Visual difference

    Quote Originally Posted by Nightwalker83
    Yeah, the difference between is clear now!
    By the way have you found a complete list of style-attributes. Still I haven't see any complete document except this.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  11. #11

    Thread Starter
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: [RESOLVED] Visual difference

    Quote Originally Posted by eranga262154
    By the way have you found a complete list of style-attributes.
    I have been using Devguru!
    Last edited by Nightwalker83; Oct 17th, 2007 at 02:07 AM.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  12. #12
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: [RESOLVED] Visual difference

    The official CSS property index is a great place to visit.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width