Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using CSS font - the text moves to second line

 
JackKumar Kumari
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the code below from W3schools. I am having a similar issue.
In line <h3>This</h3> is header 3
It is coming in 2 diff lines.
How can I get it in same line. I want only "This" to be bold.

Thanks in Advance.



The result looks like this:

This
is header 3
This is a paragraph

This is a paragraph



 
Dawn Charangat
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has nothing to do with CSS.

<H1> to <H6> tags are used for denoting headings. Hence HTML always makes sure that the heading is in its own line [atleast most browsers do].
This situation will prevail, even if you remove the style declaration for your <h3>.

However, if all you need is to set "bold" style on one of your words, why don't you try this ?

<b>This</b> is header 3
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are using the tag incorrectly.

If you want only part of the header bold:


And use CSS as appropriate to get the look you want.

The HTML markup is for structure not style. Using the markup incorrectly to achive style rather than structure is what can get you into a fine mess.
 
JackKumar Kumari
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot! It works....
I am learning.........
 
Brian Legg
Ranch Hand
Posts: 488
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are learning CSS/HTML I would keep clear of the "p" tag as it adds spacing after it automatically and all styles you place on the p element have been depreciated.

"All "presentation attributes" of the p element were deprecated in HTML 4.01, and are not supported in XHTML 1.0 Strict DTD" <-- This is from w3schools as well.

I usually wrap a paragraph or paragraphs in a div. I can define my own styles and such on the paragraph(s) without effecting the rest of the page. Anytime I mix divs and classes with the p tag I always end up with spacing issues when it comes to cross browser friendlyness.

I hope that helps. I think your other issues were already addressed.
 
JackKumar Kumari
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Brian. I will keep in my mind while coding.

My other issue is still open. I think I am not being able to explain properly.
I will try again in my other post.

But I really appreciate everyone's help in here.

Thanks again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic