|
|
Post a Project »
Find a Professional HTML Freelancer!
Find a Freelancer to help you with your HTML projects
| |
|
Italics causes div to misbehave?
03-26-2006, 05:09 AM
|
Italics causes div to misbehave?
|
Posts: 5
|
It's the wierdest thing, and I can't figure it out, so I'm asking:
I have a 2nd column that is setup on my stylesheet as a div.
If I use italics for a paragraph, i.e., starting immetidately after the paragraph code (<p>), and if it also ends at a code (this time <br />, or previously </p>), it ignores the div column, and continues the text as column one?
eg.
<p><i>blah blah blah blah</i><br />
or
<p><i>blah blah blah blah</i></p>
I am using coffeecup software to create my pages, maybe it has something to do with that, although I can't figure out how, but then, why should character formatting in any way affect a css div that occurs paragraphs before it on the page is what has me stumped to begin with.
<sigh>
Any ideas?
|
|
|
|
03-26-2006, 06:49 AM
|
Re: Italics causes div to misbehave?
|
Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
|
You have probably missed off a closing tag somewhere, as in your first example with the missing </p>
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
03-26-2006, 02:17 PM
|
Re: Italics causes div to misbehave?
|
Posts: 190
|
Correct me if I am wrong, nd this post probably won't fix your problem, but Isnt <p> a self closing tag? I have never had to close it with </p> and from all the tutorialss and thing I read wehn I was learning html, I didnt even realize that </p> was a legitimate tag.. I learned something new today.
But we might be ble to help more if you posted the code thats giving you trouble.
|
|
|
|
03-27-2006, 12:09 AM
|
Re: Italics causes div to misbehave?
|
Posts: 5,935
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
|
In XHTML, the </p> tag is required.
wyrde: have you tried something like this?
Code:
<p style="font-style: italic">Your stuff here</p>
Try that (make sure you spell it the way I spelled it here, not italic s.)
|
|
|
|
03-27-2006, 01:01 AM
|
Re: Italics causes div to misbehave?
|
Posts: 488
Name: Chip Johns
Location: Savannah Georgia
|
And when you are using css. It is even more important to close all tags.
|
|
|
|
03-27-2006, 06:32 AM
|
Re: Italics causes div to misbehave?
|
Posts: 111
|
that's not true. The <p> tag CAN be closed, but is not required. not even in XHTML.
|
|
|
|
03-27-2006, 09:05 AM
|
Re: Italics causes div to misbehave?
|
Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
|
Yes a <p> does not need a closing tag
However in this case (should anyone read the original post fully, in particular this bit
Quote:
|
I have a 2nd column that is setup on my stylesheet as a div
|
)
A <p> element cannot contain any block level elements, so when the paragraph is NOT closed it will actually contain the 2nd column <div>
Hey Presto! instant error.
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
03-27-2006, 10:26 AM
|
Re: Italics causes div to misbehave?
|
Posts: 5
|
The thing is, and I double-triple checked this, I did have all the closing tags, both </i> and </p> (which I use by habit, since programming can be so finicky I'd rather have xtra than not enuff).
However, the ---
<p style="font-style: italic">Your stuff here</p>
--- suggestion should solve my problem handily.
Thanks for your comments and help!
Wyrde
|
|
|
|
03-27-2006, 01:28 PM
|
Re: Italics causes div to misbehave?
|
Posts: 170
Location: Canada
|
Quote:
|
Originally Posted by pipers dragon
Correct me if I am wrong, nd this post probably won't fix your problem, but Isnt <p> a self closing tag? I have never had to close it with </p> and from all the tutorialss and thing I read wehn I was learning html, I didnt even realize that </p> was a legitimate tag.. I learned something new today.
But we might be ble to help more if you posted the code thats giving you trouble.
|
I'm correcting you, you're wrong. If you're coding in old messy html you can leave tags open like that. However, if you want to make everything w3c valid you need to close EVERY tag.
If you don't want to use CSS italic text you should know that the <i> tag is no longer valid. use <em></em> instead.
|
|
|
|
03-27-2006, 02:41 PM
|
Re: Italics causes div to misbehave?
|
Posts: 488
Name: Chip Johns
Location: Savannah Georgia
|
Here is an example
Invalid code
|
|
|
|
03-27-2006, 09:28 PM
|
Re: Italics causes div to misbehave?
|
Posts: 5,935
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
|
That worked. Great example.
|
|
|
|
03-28-2006, 08:22 AM
|
Re: Italics causes div to misbehave?
|
Posts: 5
|
Ahhhh, so I should be using the <em></em> tag for proper xhtml? The funny thing is, the <i></i> tag works great... if it isn't the entire paragraph.
One of the great things about life is that I learn something new every day!
Thanks Chip!
|
|
|
|
03-28-2006, 11:12 AM
|
Re: Italics causes div to misbehave?
|
Posts: 170
Location: Canada
|
Yes, the <i></i> tag works, but is not valid XHTML.
|
|
|
|
03-28-2006, 01:27 PM
|
Re: Italics causes div to misbehave?
|
Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
|
The <i> tag is perfectly valid in XHTML
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
03-28-2006, 01:46 PM
|
Re: Italics causes div to misbehave?
|
Posts: 170
Location: Canada
|
I stand corrected. I checked the W3c validator, and it let the <i> tag slide. I was taught that it was being replaced by the <em> tag (guess my teachers wrong). I'll do some more research on the <em> tag.
Upon further study I have discovered why I was told to use <em> as opposed to <i>. <i> is visual only, it just makes your text italic. <em> however declares Emphasis upon a certain block of text. SO in the event that the visaully impared are viewing your page, the <strong> and <em> tags should be used instead of <b> and <i>. The visual effect would be the same, but it would be spoken differently.
Last edited by collyer_1; 03-28-2006 at 02:00 PM..
|
|
|
|
03-28-2006, 02:57 PM
|
Re: Italics causes div to misbehave?
|
Posts: 488
Name: Chip Johns
Location: Savannah Georgia
|
<i> is a visual element. It makes the look of the text different (i.e., look like italicized text.)
<em> is a structural element. When we use <em> it is putting emphasis on the words inside the tag.
Both are valid, however <em> provides the structural element. That is why <em> should be used for accessibility compliance and <i> should not.
It is equivalent to using font to increase the size of the text at the top of the page. It makes it bigger but doesn't provide the structural element of <h1> .
|
|
|
|
03-28-2006, 06:58 PM
|
Re: Italics causes div to misbehave?
|
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
|
If I'm not mistaken <i> and <b> will be going away at some point in the future. At least that's the impression I've been under for awhile now. I use <em> and <strong> in their place. With the latter tags browsers are free to present the text inside however they want, but as far as I know all will italicize <em> and make bold <strong>.
And with xhtml it is necessary to close all of your tags. Even tags like <br> that don't have a normal corresponding closing tag should be written as <br />.
|
|
|
|
|
« Reply to Italics causes div to misbehave?
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|