It seemed a good idea at the time to define a width for the <p> element:

content p { width: 450px; }

But now after building 80 pages into my CMS, I need <p> to act like normal with no width on certain pages.

content .myclass p { width: "not-set"; }

auto doesn't work, 100% doesn't work. I've considered a javascript solution that messes with class names, but would prefer a css rescue of seven or eight characters!

tx

PicnicTutorials
—
2011-03-25T18:13:56Z —
#2

If you have the class on the p then it should look like #content p.myclass {}

system
—
2011-03-25T18:15:20Z —
#3

Switch them. Sort of.

content .specialPageThatNeedsWidthOnParagraphs p { width: 450px; }

content p { /*width: "not-set";*/ }

Gregster606
—
2011-03-25T18:29:13Z —
#4

noonnope said:

Switch them. Sort of.

#content .specialPageThatNeedsWidthOnParagraphs p { width: 450px; }

#content p { /*width: "not-set";*/ }

Yes, that would work, but, I have 25 pages of little used old newsletters that require p to be normal and 80 pages of much used info that use the width. I am building this into a CMS that I want non coders to be able to enter content into. I am afraid adding a div to the page would blow their minds.

The 25 pages are old code that employ inline style declarations in tables.

Gregster606
—
2011-03-25T19:54:36Z —
#5

I guess you can't cancel, only replace, so I am going to use php to make it happen. Something like putting in the body tag:

Yes, that would work, but, I have 25 pages of little used old newsletters that require p to be normal and 80 pages of much used info that use the width. I am building this into a CMS that I want non coders to be able to enter content into. I am afraid adding a div to the page would blow their minds.

The 25 pages are old code that employ inline style declarations in tables.

Can you distinguish between the pages (a class or id on the body tag or similar)? If so then you could set up the fixed width to only apply for the class or id used by the new pages.

Candygirl
—
2011-03-26T17:09:30Z —
#9

Hello,

Gregster606 said:

content p { width: 450px; }

But now after building 80 pages into my CMS, I need <p> to act like normal with no width on certain pages.

#content .myclass p { width: "not-set"; }

auto doesn't work, [...]

There is no CSS reason for that not to work (if no other related declarations):

#content p { width: 450px; }
#content .myclass p { width:auto; }

The second selector set back the default value auto

The second selector is more specific then the first one

Have you check the first assumption that you may not target the right element with your second selector ?

EricWatson said:

If you have the class on the p then it should look like #content p.myclass {}