h1 tag in the middle of sentence

Discussion in 'CSS' started by adresanet, Jan 13, 2011.

  1. #1
    Hello,

    I need to use <h1> h1 tag in the middle of sentence.

    h1{display: inline;font-size:11px; font-family:Tahoma,Verdana,Arial;border-size: thin;} doesn't help me because the word after <h1> is listed on new line.

    Can you help me ?
     
    adresanet, Jan 13, 2011 IP
  2. Dodger

    Dodger Peon

    Messages:
    1,494
    Likes Received:
    60
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You do know that that is not the correct way to use a Heading element? And, why would you want a heading in the middle of a sentence?
     
    Dodger, Jan 13, 2011 IP
  3. jeremyhowell

    jeremyhowell Member

    Messages:
    379
    Likes Received:
    7
    Best Answers:
    2
    Trophy Points:
    45
    #3
    As already pointed out, you are not using H1 properly, of course it will create a new line, the idea of h1 is it is a title not an inline element. I suggest you use span with an assigned class.

    
    
    <style>
    .spanclass1 {font-size:11px; font-family:Tahoma,Verdana,Arial; border-size: thin;}
    </style>
    
    
    Code (markup):
    
    <p>Hello world <span class="spanclass1">How</span> Are you?</p>
    
    Code (markup):
     
    jeremyhowell, Jan 13, 2011 IP
  4. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #4
    radiant_luv, Jan 15, 2011 IP
  5. markup

    markup Peon

    Messages:
    116
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    please do not use h1 tag in the middle of the sentence

    H1 tag can be used for main heading/title for that page and also please use only one h1 tag for a web page
     
    markup, Jan 15, 2011 IP
  6. Dodger

    Dodger Peon

    Messages:
    1,494
    Likes Received:
    60
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Judging by the font size in the OP CSS, this person is trying to disguise an H1 heading mid-paragraph for some reason. Due to lack of response, he is probably out there somewhere trying to figure it out.
     
    Dodger, Jan 15, 2011 IP
  7. diondevelopment

    diondevelopment Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Use a SPAN instead, and replace "display: inline;" with "display: inline-block;" in order to get the border to show nicely.
     
    diondevelopment, Jan 15, 2011 IP
  8. Riboflavin

    Riboflavin Well-Known Member

    Messages:
    1,091
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    155
    #8
    He probably thinks he can put his keywords in h1 tags all over the page. Sorry Adresanet, but google is smarter than you and will not give you anything positive for this, infact it may hurt your serps.
     
    Riboflavin, Jan 16, 2011 IP
  9. steelfrog

    steelfrog Peon

    Messages:
    537
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Headers are block-level elements. By default, they will take up an entire line and break whatever content they're found within. While this is completely the wrong way to use headers, you can adjust this behavior in your CSS.

    h1 { display: inline; }
    Code (markup):
    This will render your header as an inline object. However, I do very strongly suggest you look at how headers are properly used as you're creating problems for yourself down the line.
     
    steelfrog, Jan 18, 2011 IP
  10. jeremyhowell

    jeremyhowell Member

    Messages:
    379
    Likes Received:
    7
    Best Answers:
    2
    Trophy Points:
    45
    #10
    Thank you very much for pointing that out, I have just got back from my holiday, will change it now, thanks mate.
     
    jeremyhowell, Jan 20, 2011 IP