IE and width & height issues
IE has a rather strange way of doing things. It doesn't understand the
This can cause problems, because we may need boxes to be resizable should more text need to go in them or should the user resize text. If we only use the
This can be especially problematic when using background images. If you're using a background image that's 80px wide and 35px high, then you'll want to make sure that the default size for a box using this image is exactly 80 x 35px. However, if users resize the text then the box size will need to expand gracefully.
To resolve this problem, you can use the following code for a box with
IE has a rather strange way of doing things. It doesn't understand the
min-width
and min-height
commands, but instead interprets width
and height
as min-width
and min-height
- go figure!This can cause problems, because we may need boxes to be resizable should more text need to go in them or should the user resize text. If we only use the
width
and height
commands on a box then non-IE browsers won't allow the box to resize. If we only use the min-width
and min-height
commands though then we can't control the width or height in IE!This can be especially problematic when using background images. If you're using a background image that's 80px wide and 35px high, then you'll want to make sure that the default size for a box using this image is exactly 80 x 35px. However, if users resize the text then the box size will need to expand gracefully.
To resolve this problem, you can use the following code for a box with
class="box"
:.box
{
width: 80px;
height: 35px;
}
html>body .box
{
width: auto;
height: auto;
min-width: 80px;
min-height: 35px;
}
All browsers will read through the first CSS rule but IE will ignore the second rule because it makes use of the child selector command. Non-IE browsers will read through the second one and will override the values from the first rule because this CSS rule is more specific, and CSS rules that are more specific always override those that are less specific.
Other Topics
CSS : Background colour running to the screen bottom,CSS : Text-transform command,CSS : IE and width & height issues,CSS : Drop down menu,CSS : Accordion Menu: CSS
coding,CSS : Zoom property,CSS : Relative zoom,CSS3 : target-new Property ,CSS : 3-d push button effect ,CSS : Document for handhelds ,CSS : Invisible text ,CSS : Disappearing text or images in IE?
,CSS : Image replacement technique,CSS : Box model hack alternative,CSS : Centre aligning a block element,CSS : Class selector,CSS : Sticky Footer Layout,CSS::STYLING FORMS, mechanical Engineering, English books,Photoshop tutorials,Harry potter,Best 100 english books,Mechanical-old-question-paper,CSS : Id Selector
No comments:
Post a Comment