mjansen.merge.emed (AT) gmail (DOT) com <mjansen.merge.emed (AT) gmail (DOT) com> scripsit:
Quote:
Is there a way to override inline within the <body> a style of an
element but not do it with a style attribute on the element? |
You can use a class or id attribute and a suitable selector in the
stylesheet that you have in a <style> element or in an external stylesheet.
Quote:
I know
CSS Inheritance works for some styles, but doesn't appear to work for
margins, etc. |
How does inheritance affect the issue? Beware that inheritance is the most
often misunderstood concept in CSS. If you set a value to a property of an
element, no inheritance affects that property of that element.
Quote:
I'm generating HTML. I don't have access to the <head>. |
So you are generating an HTML fragment, right? This is a bad situation. Are
you sure there is no _solution_ to this, so that you need to look for
workarounds and tricks?
Quote:
In the
head> is a stylesheet that defines a style for <p>. I have HTML I am
wrapping around other generated HTML (that I don't have access to)
that emits a <p> tag, and its getting (obviously) the style from the
stylesheet. So I'd like to be able to override the style via some
surrounding elements. |
Why do you think you need surrounding elements? What is the reason for
excluding the of the style attribute (on the element itself), which would be
the _simplest_ way, assuming that you cannot affect the <head> element (or
an external style sheet? Actually, it looks pretty much the only solution
under the circumstances.
Quote:
!-- POINT A: begin what i have control over --
div style="position:absolute; top:0px; right:0px;"
!--begin more stuff i don't have control over --
p>TheOtherGeneratedStuff</p
!-- back to me again--
/div |
If I understand you right, you are saying that you can only affect some
elements in the document tree, excluding their subelements. I wonder what's
the point is such a setting. I'd look for a solution, consisting of a change
in the overall setting, rather than solving the virtually unsolvable puzzle.
No, there's really no way interfere in such a manner. You can set properties
for an element using the style attribute, but not for its subelements; they
may inherit properties, but that's their business - and won't happen when a
style sheet sets a property for an element.
Quote:
Could I
just insert some java script to save and restore the <p> style ? |
Maybe, but what would happen when scripting is disabled or your JavaScript
code is simply filtered out by a company firewall in the user's
organization?
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/