Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    Regular Coder
    Join Date
    Dec 2007
    Location
    on earth
    Posts
    183
    Thanks
    49
    Thanked 2 Times in 2 Posts

    Default H2 and CSS

    Hello all,
    The H2 titles in the content are too big by default as you can see on <this page>
    What is the best way to define all H2 that are in the div class = "postcontent"?
    Is it smth like
    Code:
    h2#postcontent
    {
    font-family: arial,helvetica,sans-serif;
    font-size: 14px;
    }
    thanks a lot for your advice ;-)

  • #2
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Very close

    Code:
    #postcontent h2
    {
    font-family: arial,helvetica,sans-serif;
    font-size: 14px;
    }
    The outside element comes first (the DIV id), and then H2.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #3
    Regular Coder
    Join Date
    Dec 2007
    Location
    on earth
    Posts
    183
    Thanks
    49
    Thanked 2 Times in 2 Posts
    Thanks Jeremy,
    Has not worked though, added the code to css line 459. Still big size....
    any idea?
    oh hang on. thats because I had to define it in the container. works, thanks ;-)
    Code:
    #container h2
    {
    font-family: arial,helvetica,sans-serif;
    font-size: 14px;
    }

  • #4
    Regular Coder BabyJack's Avatar
    Join Date
    Apr 2008
    Location
    Somewhere.
    Posts
    602
    Thanks
    43
    Thanked 6 Times in 6 Posts
    Jeremy's code was fine.
    Code:
    #postcontent h2
    {
    font-family: arial,helvetica,sans-serif;
    font-size: 14px;
    }
    Do you have any other H2 tags, that may be over-riding this code?
    Enlightenment in Coding
    Validate before Posting | Google is your friend for PC Problems | Make sure you have a doctype

  • #5
    Regular Coder
    Join Date
    Dec 2007
    Location
    on earth
    Posts
    183
    Thanks
    49
    Thanked 2 Times in 2 Posts
    alright,
    reverted to Jeremy's, but as you can see it does not work. If you want to ponder on it, please do, otherwise I will just stick to container h2.
    No other H2 tags I dont think, a part from the home page for which I use
    Code:
    <h2 class="menu_titles">Ancient Egypt</h2>
    for menu boxes
    Last edited by mikacruz; 11-02-2008 at 12:07 PM.

  • #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    Wait wait..., the operator to address a class is a period, not #
    Code:
    div.postcontent h2{
    font-family: arial,helvetica,sans-serif;
    font-size: 14px;
    }
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #7
    Regular Coder BabyJack's Avatar
    Join Date
    Apr 2008
    Location
    Somewhere.
    Posts
    602
    Thanks
    43
    Thanked 6 Times in 6 Posts
    Aha, you need a full stop (.) Not a #.

    So...
    Code:
    .postcontent h2 {
    font-family: arial,helvetica,sans-serif;
    font-size: 14px;
    }
    Edit: He beat me ^
    Enlightenment in Coding
    Validate before Posting | Google is your friend for PC Problems | Make sure you have a doctype

  • #8
    Regular Coder
    Join Date
    Dec 2007
    Location
    on earth
    Posts
    183
    Thanks
    49
    Thanked 2 Times in 2 Posts
    the error was an appreciation error, the size of the titles H2 being too big, by default compared to paragraph size....

    Abdu, your code works. If you have time tell me why your code is more appropriate than
    Code:
    #container h2
    {
    font-family: arial,helvetica,sans-serif;
    font-size: 14px;
    }
    which works also,
    Thanks guys
    Last edited by mikacruz; 11-02-2008 at 12:16 PM.

  • #9
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Found the error, your code for postcontent is a class, not an id, so it should be

    Code:
    .postcontent h2
    {
    font-family: arial,helvetica,sans-serif;
    font-size: 14px;
    }
    Dang everyone at once.

    #postcontent refers to a <div> with the id="postcontent"
    .postcontent refers to a <div> with the class="postcontent"

    Sorry for not reviewing the code the first time from your site, just took what you gave!
    Last edited by gnomeontherun; 11-02-2008 at 12:19 PM. Reason: explain
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #10
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #11
    Regular Coder
    Join Date
    Dec 2007
    Location
    on earth
    Posts
    183
    Thanks
    49
    Thanked 2 Times in 2 Posts
    ok :-)

    All work
    Code:
    #container h2
    {
    font-family: arial,helvetica,sans-serif;
    font-size: 14px;
    }
    Code:
    div.postcontent h2{
    font-family: arial,helvetica,sans-serif;
    font-size: 14px;
    }
    will choose that 2nd one :-)

    Code:
    .postcontent h2
    {
    font-family: arial,helvetica,sans-serif;
    font-size: 14px;
    }

  • #12
    Senior Coder
    Join Date
    Oct 2008
    Location
    Long Beach
    Posts
    1,196
    Thanks
    36
    Thanked 164 Times in 164 Posts
    (deleted post, wasn't relevant )


  •  

    Posting Permissions

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