If one accidentally or purposely puts a paragraph (tag) inside a table cell, how does one remove it without hand-editing the markup? A paragraph tag makes the row height too high. I get rid of all the leading and trailing spaces using Delete key etc., but the paragraph remains. This can drive users bats. It will have <td><p>foo</p></td> when what's wanted is <td>foo</td>. Thanx.
Tue, 05/14/2013 - 23:31
#1
Just ran into this same issue
Just ran into this same issue and solved it by directly editing the HTML, but this is certainly not a "solution" acceptable to end-users. Looking to see if there's a better way to do this as well, so.. bump!
It will have <td><p>foo</p><
It depends on Enter Mode used http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-enterMode . If you type in table and press Enter text gets wrapped in P, DIV or is separated by BR depending on Enter Mode used.
You can either use Enter Mode set to BR or better leave default and best handled P and style paragraph in contnets.css or page styles if you use inline editor. As you probably know P can be styled by browser itself. Browser for example adds default margins thus making paragraph look big. If you add rules for paragraphs in contents.css margins won't bother you anymore.
Please note that styles in external CSS files aren't transferred when you save mark-up. Solution here is using same styles in contents.css that you want to have on resulting page.
Note that shrinking the
Note that shrinking the margins around paragraphs in cells may create the secondary problem of spacing between paragraphs inside of cells. One generally wants spaces between two more paragraphs inside of a table cell. I don't know if clever enough CSS exists to control spacing in such way that spacing doesn't apply to the very first and very last parts of the text. Maybe jQuery?
(In the HTML standard, paragraphs should have been defined as separators, not as containers in my opinion.)
The work-around may be to create a function key or tool icon to remove P tags, and we could put this in the user documentation.
if clever enough CSS exists
What aboout http://www.w3schools.com/cssref/css_selectors.asp ? Won't something like
work?
These selectors are available from CSS2 and work even in older versions of IE (provided that doctype is used i.e. quirks mode won't be activated).
Using
Using
works perfectly because the user always sees no margin around the paragraphs, so if he needs a separation then he will add an empty paragraph as needed, no matter if it's inside a table cell, in the document body or in any other situation.