1

You have the following HTML:

<object height="400"></object>

In the CSS, you have:

object { height: auto; }

Is there a way to omit the CSS height: auto without deleting it? In other words, is there a way to make the attribute value override the stylesheet?

2
  • 3
    height="400" isn't inline CSS, it's an attribute with a value. Inline CSS would be style="height:400px" Commented Oct 22, 2013 at 14:55
  • You are completely correct, I have edited my question. Thanks! Commented Oct 22, 2013 at 14:56

4 Answers 4

3

use the style tag on an element:

<object style="height:400px"></object>

Sign up to request clarification or add additional context in comments.

Comments

1

Use the :not selector:

http://cssdeck.com/labs/bgv0buyf

object:not([height]) {
  height: auto;
}

Comments

0

CSS in the style attribute will override that defined against an element. If it's not doing that in your code, then there is likely some other CSS rule being applied.

I'd suggest using a DOM inspector such as the one in chrome developer tools (right click -> inspect element) to see what's going on.

For more info, read up on CSS specificity.

Comments

0
<object style="height:400px !important;"></object>

css inline statement overrides ext stylesheet references. use developer tools to figure out css overrides.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.