![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||||
| |||||
|
|
In the past, I have used this structure: p>I'm trying to display a paragraph that has a centered phrase, center>such as this one,</center in the middle of the paragraph.</p |
|
This, or with the <center> replaced by div align="center">. |
|
Error Line 377, Column 7: end tag for element "P" which is not open. My *guess* as to why this is happening is that the presence a of a block element (either "div" or "center") inside of a <p> is causing a </p> to be inserted before the block element. |
|
It would not be disaster if I had to typeset this as p>I'm trying to display a paragraph that has a centered phrase,</p center>such as this one,</center p>in the middle of the paragraph.</p |
|
but I'm wondering if I can * typeset it as a single paragraph, the way I think of it, * have a centered fragment (like a "displayed equation" in a mathematics textbook) * have the document validate. |
#3
| |||
| |||
|
|
Scripsit gentsqu... (AT) gmail (DOT) com: In the past, I have used this structure: p>I'm trying to display a paragraph that has a centered phrase, center>such as this one,</center in the middle of the paragraph.</p While it may give the impression of working, it is invalid markup, as you have noted. It's not just a theoretical issue, since you get a wrong document tree in the Document Object Model. For example, if you assign a CSS rule that applies to p elements, it will only be applied to the part that precedes the <center> tag, since by HTML parsing rules, the paragraph ends there. |
|
... You can use <span>, with a suitable class attribute, for the text you wish to center, and use CSS for displaying the span element (which is inline by HTML rules, hence allowed inside a p element) ... with CSS code like ... .special { display: block; text-align: center; } |
#4
| |||
| |||
|
|
The LaTeX macro I call "\display". Is there any reason I shouldn't call the CSS "jukkaspecial" class by the name "display", so that I'll remember what it does? |
|
My concern is that "display" is also meaningful in CSS. |
#5
| |||
| |||
|
|
I'm trying to display a paragraph that has a centered phrase, such as this one, in the middle of the paragraph. |
![]() |
| Thread Tools | |
| Display Modes | |
| |