HTML h2 tag doing problem!!!

Discussion in 'HTML & Website Design' started by vipsy, Dec 31, 2012.

  1. #1
    Hey i am having problem formatting h2 styles in html.

    my main heading is on h1.

    and my numbered heading is h2.

    the problem arising is that on putting 1.<h2>HEADING</h2>- the HEADING is starting from different line i.e.
    1.
    HEADING
    -

    Is there any way i can bring them on same line apart from putting whole thing inside h2 tags??
     
    vipsy, Dec 31, 2012 IP
  2. HostUS - Alexander

    HostUS - Alexander Greenhorn

    Messages:
    53
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    23
    #2
    Whats your CSS code for your h2 tag?

    Cheers
     
    HostUS - Alexander, Dec 31, 2012 IP
  3. vipsy

    vipsy Greenhorn

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    6
    #3
    I am not using CSS since its a single webpage.
     
    vipsy, Dec 31, 2012 IP
  4. vipsy

    vipsy Greenhorn

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    6
    #4
    I am not using CSS since its a single webpage.
     
    vipsy, Dec 31, 2012 IP
  5. Original Hosting

    Original Hosting Active Member

    Messages:
    203
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    50
    #5
    Put the code as follows, this makes the bullet point H2 as well.

    <h2><li>HEADING</li></h2>

    Hope this helped.
     
    Original Hosting, Dec 31, 2012 IP
  6. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #6
    <hx> is a block element. If you want the text before the heading to be on the same line (which is semantically incorrect, since headings don't have text that's not part of the heading), you'll have to use CSS to position things.
     
    Rukbat, Dec 31, 2012 IP
  7. creativewebmaster

    creativewebmaster Active Member

    Messages:
    654
    Likes Received:
    7
    Best Answers:
    4
    Trophy Points:
    78
    #7
    You needs to be edit your .li class
     
    creativewebmaster, Jan 1, 2013 IP
  8. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #8
    I'm having issues following the English (or lack therin) in this thread -- but not ony is the language used incomprehesible, the code shown so far is gibberish too.

    @"Original Hosting" -- LI can't go inside H2 -- the parent of a LI must be a OL or UL.

    @Vipsy -- I think you are failing to grasp what headings are for -- you want that 1. on the same line it should be inside the heading, not before it... but really without seeing the actual code for the entire page in question ANYTHING we tell you is a wild guess in the dark. That said if you are using them as headings inside a list you are missing the entire point of the numbered heading tags... that being lower ordered (higher numbered) indicate the start of a subsection of the higher order (lower numbered) heading preceeding it... that's why skipping numbers is bad, having more than one h1 doesn't make any sense, and since you're saying they are sections by using heading tags, you shouldn't have them as lists, numbered or otherwise.

    But again, without seeing the content and HTML you are trying to use (as in the ENTIRE page), we're all guessing wildly.
     
    deathshadow, Jan 1, 2013 IP
  9. WillisOz

    WillisOz Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #9
    As Rukbat said Heading tags are block elements not inline elements which is what's causing your issue. Why do you want to use a heading tag within a list anyway? Why not just create a style on your li tag or create an li class like creativewebmaster suggested? Much easier and definitely less hassle.
     
    WillisOz, Jan 1, 2013 IP
  10. irummuneery

    irummuneery Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    hi vipsy you use this method <h1>1.Heading2</h1>
     
    irummuneery, Jan 3, 2013 IP
  11. sianipar

    sianipar Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    not quite sure what you are trying to accomplish, but this may help:

    <h1>Main Heading</h1>
    <ol>
        <li><h2>Sub Heading 1</h2></li>
        <li><h2>Sub Heading 2</h2></li>
    </ol>
    Code (markup):
     
    sianipar, Jan 3, 2013 IP
  12. coakleylincoln

    coakleylincoln Greenhorn

    Messages:
    286
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #12
    @sianipar interpretive syntax...
     
    coakleylincoln, Jan 3, 2013 IP