Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML - CSS: Styling <object>?

Tags:

html

object

css

If my div container has this:

<div id="container"><img src...

I can style the image by this:

CSS
#container img{ ... }

For object tag

<div id="container"><object ...

How do I address it? I tried this:

CSS
#container object{ width: 100px; }

But it does not work.

Assume the I cant define "id" or "class" for the object tag

I am using tinymce to embed to youtube video. And the code will be rendered like this:

<div id="container">
...

    <div id="content">
      <p>
      <object width="435" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/l9caxMr9RgY">
      <param value="http://www.youtube.com/v/XXXXXX" name="src"></object>
      </p>
    </div>
</div>
like image 599
wepper Avatar asked Dec 14 '10 09:12

wepper


2 Answers

An object tag can be styled using CSS. Ref link text

The reason width didn't work in your example is that its a HTML attribute only and not accessible with CSS (see list in link above).

I would recommend that you put the object into a wrapper div (give the object a width of 100%) and control the width of the wrapper div with css.

like image 157
robzolkos Avatar answered Oct 02 '22 14:10

robzolkos


You already add size and width to the object style="width: 100px; height: 100px;"

Example

like image 43
Blur Avatar answered Oct 02 '22 16:10

Blur