aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Using CSS font - the text moves to second line Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Using CSS font - the text moves to second line" Watch "Using CSS font - the text moves to second line" New topic
Author

Using CSS font - the text moves to second line

JackKumar Kumari
Greenhorn

Joined: Mar 23, 2009
Posts: 14
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

Joined: Apr 26, 2007
Posts: 249
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

Joined: Jan 10, 2002
Posts: 61768
    
  67

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.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
JackKumar Kumari
Greenhorn

Joined: Mar 23, 2009
Posts: 14
Thanks a lot! It works....
I am learning.........
Brian Legg
Ranch Hand

Joined: Nov 07, 2008
Posts: 488
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.


SCJA
~Currently preparing for SCJP6
JackKumar Kumari
Greenhorn

Joined: Mar 23, 2009
Posts: 14
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using CSS font - the text moves to second line