PDA

View Full Version : width property and inheritance



wolfheart_2001
Oct 5th, 2009, 04:25 AM
hi,

im new to CSS, so i have couple of questions.

1-should i use width as an attribute in the container elemnets or should i use classes and css?

2-if i use img inside div and i tried to use width: inherit; nothing happens and the img didnt inherit the width property of the containing div element.why is that?

regards

abduraooft
Oct 5th, 2009, 09:32 AM
1-should i use width as an attribute in the container elemnets or should i use classes and css? The attribute width is deprecated except on <img> tag. So use it in CSS/style


2-if i use img inside div and i tried to use width: inherit; nothing happens and the img didnt inherit the width property of the containing div element.why is that?
Are you trying to stretch the image inside container? Is is supposed to be a background image?

wolfheart_2001
Oct 5th, 2009, 10:51 AM
no..i want to place a header image at the top of the page..its inside a <td> element..but using {width: inherit} with the image dont get the width of the <td> so it dont stretch.

abduraooft
Oct 5th, 2009, 11:00 AM
no..i want to place a header image at the top of the page..its inside a <td> element..but using {width: inherit} with the image dont get the width of the <td> so it dont stretch.
You may set width:100%; in style/CSS.

btw, If you are using tables for making your layout, it's very bad (http://www.hotdesign.com/seybold/)!

Scriptet
Oct 5th, 2009, 04:16 PM
The attribute width is deprecated except on <img> tag. So use it in CSS/style



I think we should also use it on objects/embeds aswell