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??
Put the code as follows, this makes the bullet point H2 as well. <h2><li>HEADING</li></h2> Hope this helped.
<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.
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.
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.
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):