Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Cell format in new table row

Community Beginner ,
Jun 14, 2022 Jun 14, 2022

When I create a new row in a table (control click in a cell > Table > Insert Rows or Columns) the cell is formatted by default as None. I would like cells in new rows to be formatted as Paragraph.

I have done extensive searches, but haven't found an answer.

707
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 15, 2022 Jun 15, 2022
quote

Well it may if the intended CSS styles are applied to <p> tags and not <td> tags.

By @Nancy OShea

 

isn't it easiest to add a , td to the p rules,

as

before

p {
 /* any description */
}

after

p, td {
 /* any description */
}

than adding a P tag deep in the butter just to get a styled content.. except as @L e n a  point at for a semantic need (Well I don't personnaly see any P semantic need in within a TD)

Translate
Community Expert ,
Jun 14, 2022 Jun 14, 2022

Cells are not styled as paragraphs.  Paragraphs are styled as paragraphs.

 

By way of example:

<table border="1" cellpadding="5">
<tr>
<th><h1>Heading</h1></th>
<th><h1>Heading</h1></th>
<th><h1>Heading</h1></th>
</tr>

<tr>
<td><p>This is a paragraph....</p></td>
<td><p>This is a paragraph....</p></td>
<td><p>This is a paragraph....</p></td>
</tr>
</table>

 

That said, Tables are for tabular data only (charts & spreadsheets).  Use CSS for webpage layouts.

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 14, 2022 Jun 14, 2022

These are labels and sentences within cells. What I'm referring to is the paragraph format that contains my font choice, as shown in the inspector.

The data is (are?) tabular. The page is just a simple table with many rows. No embedded tables.

I think in the past a new row had the correct formatting as a default, but I must have changed something.

 

Here's an example:

<tr style="font-family: 'Gill Sans', 'Gill Sans MT', 'Myriad Pro', 'DejaVu Sans Condensed', Helvetica, Arial, sans-serif">
<td width="234" bgcolor="#FAF9F9"><p>Morocco </p></td>
<td><p>1930</p></td>
<td width="207"><p>Gary Cooper<br>
Marlene Dietrich<br>
Adolphe Menjou<br>
Eve Southern<br>
Ullrich Haupt </p>
<p>Director:<br>
Josef von Sternberg </p></td>
<td><p><img src="picsdate/morocco.jpg" width="240" height="205" alt=""/></p></td>
<td><p>Madame Caesar, (Eve Southern), blah, blah.<br>
Several other shots in this set show Thonet No. 18s.</p></td>
</tr>

 

I'm aware that, with a lot of work, I could recreate the table with CSS.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 14, 2022 Jun 14, 2022

Using inline styles in HTML code is confusing and easy to break styles.  It would be better if styles were kept in a separate stylesheet.  The only time we use inline styles is when creating emails.

 

I would use definition lists for this.

https://www.the-art-of-web.com/css/format-dl/

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2022 Jun 15, 2022
quote

I'm aware that, with a lot of work, I could recreate the table with CSS.

By @habronattus

 

nope, it's pretty easy and fast...

well, launch a search and replace advanced TAB for handling the three below opérations

  1. remove all attribute in TR and TD tags
  2. remove all P tag (just the cleaning tag, not the physical removing)... I mean cleaning will remove the tag itself not the content
  3. you can leav the BR on

then apply your CSS in one shot

 

but as @Nancy OShea recommand , the use of DL, DT and DD are there for this type of purpose (among others) https://developer.mozilla.org/fr/docs/Web/HTML/Element/dl

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2022 Jun 15, 2022

I don't understand your expectations.
by inserting a new row TR, necessarily the new cell content will be either TH, or TD... but not P
the question is... what do you want to achieve... a visual of your TH and TD cells that is based on the visual used by your P tags?
or do you want your cells to automatically contain paragraphs in the form of P tags... so a semantic meaning... for what interest ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2022 Jun 15, 2022

Totally agree with @L e n a , <td><p>This is a paragraph....</p></td> does not require a P-tag.

Wappler, the only real Dreamweaver alternative.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2022 Jun 15, 2022
quote

<td><p>This is a paragraph....</p></td> does not require a P-tag.


By @BenPleysier

============

Well it may if the intended CSS styles are applied to <p> tags and not <td> tags.

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2022 Jun 15, 2022
quote

Well it may if the intended CSS styles are applied to <p> tags and not <td> tags.

By @Nancy OShea

 

isn't it easiest to add a , td to the p rules,

as

before

p {
 /* any description */
}

after

p, td {
 /* any description */
}

than adding a P tag deep in the butter just to get a styled content.. except as @L e n a  point at for a semantic need (Well I don't personnaly see any P semantic need in within a TD)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 15, 2022 Jun 15, 2022

"after
p, td"

 

Thank you. That's exactly what I was looking for.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2022 Jun 15, 2022
quote

"after
p, td"

 

Thank you. That's exactly what I was looking for.


By @habronattus

 

glad that it helped you

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2022 Jun 15, 2022

We have no idea if there is any external stylesheet.  This is all just guesswork.

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2022 Jun 15, 2022
quote

We have no idea if there is any external stylesheet.  This is all just guesswork.

By @Nancy OShea

 

I'm curious to understand what will be the difference in this particular thread and question ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2022 Jun 15, 2022

In the absence of ANY stylesheet, there are no paragraph or table cell styles to call on.  It's just an unformatted table.

 

 

 

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2022 Jun 15, 2022
quote

In the absence of ANY stylesheet, there are no paragraph or table cell styles to call on.  It's just an unformatted table.

By @Nancy OShea

 

well, maybe my English is not correct, but I did understand that styles were used when reading this...

 

quote

What I'm referring to is the paragraph format that contains my font choice, as shown in the inspector.

I'm aware that, with a lot of work, I could recreate the table with CSS.

By @habronattus

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 15, 2022 Jun 15, 2022

I do have a CSS stylesheet. I just changed the p to p, td in the .css file as B i r n o u suggested above.

Now a new row has the font I want and I don't have to insert a paragraph.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 16, 2022 Jun 16, 2022
LATEST

I appreciate the fact of getting a correct answer, but in fact I was answering to @Nancy OShea by just reformulating what was said as a first comment by @L e n a 

 

quote

nope, it's pretty easy and fast...

well, launch a search and replace advanced TAB for handling the three below opérations

  1. remove all attribute in TR and TD tags
  2. remove all P tag (just the cleaning tag, not the physical removing)... I mean cleaning will remove the tag itself not the content
  3. you can leav the BR on

then apply your CSS in one shot

By @L e n a

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 15, 2022 Jun 15, 2022

Hi Habronattus, Happy Wednesday. If you are using Tables to layout web pages you are a rockstar. Boostrap is so much easier than tables. Trust me. Here see for yourself.  https://youtu.be/kqH7ORdVzNg

Have a happy day.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines