Box-Sizing: Border-Box => for Ie8

box-sizing: border-box => for IE8?

IE8 supports the unprefixed version of box-sizing, but as with all "new" CSS features it only does so in standards mode. -ms-box-sizing has never been used by any version of IE.

Make sure your page has a doctype declaration to trigger standards mode in browsers. You should also place your unprefixed box-sizing after all the prefixes, not before them, and get rid of -ms-box-sizing as it's really not needed.

IE8 Ignoring Box-Sizing

Your #logoimg has max-height:55px.

IE 8 ignores box-sizing: border-box if min/max-width/height is used.
Source: http://caniuse.com/#search=box-sizing > Known issues #4

IE8 layout with min-height and border-box

After reading once more this sticky footer post on CSS-tricks and tinkering a bit, I found a clean solution that doesn't require any markup changes (you can do with only 3 containers: header, main and a footer) nor using box-sizing at all. It works in IE8 just as well.

html,
body {
height: 100%;
margin: 0;
}

#header,
#footer {
height: 100px;
}

#header {
margin-bottom: -100px;
}

#footer {
margin-top: -100px;
}

#main {
min-height: 100%;
width: 300px;
margin: 0 auto;
}

/* Space for header and footer. */
#main:before,
#main:after {
display: block;
content: "";
height: 100px;
}

You may like to apply the margins to main instead of header and footer.

Here's my fiddle with this solution applied: http://jsfiddle.net/ttKP3/1/

Issue with box-sizing border-box and min-width in IE 9

Hi came across your post when Googling for a similar issue with IE 8, although IE 8 supports box-sizing and min-height/width, from my tests, it seems IE 8 ignores border-box when using min-height/width on the same element

E.g.

#box {
min-height: 20px;
padding:4px;
box-sizing:border-box;
}

IE 8 height = 28px, Chrome 20 height = 20px;

Solution using css browser selectors http://rafael.adm.br/css_browser_selector/

#box {
min-height: 20px;
padding:4px;
box-sizing:border-box;
}

.ie8 #box, .ie9 #box {
min-height: 12px;
padding:4px;

}

Add padding to HTML text input field

padding-right works for me in Firefox/Chrome on Windows but not in IE. Welcome to the wonderful world of IE standards non-compliance.

See: http://jsfiddle.net/SfPju/466/

HTML

<input type="text" class="foo" value="abcdefghijklmnopqrstuvwxyz"/>

CSS

.foo
{
padding-right: 20px;
}

How do I retrieve an HTML element's actual width and height?

You should use the .offsetWidth and .offsetHeight properties.
Note they belong to the element, not .style.

var width = document.getElementById('foo').offsetWidth;

The .getBoundingClientRect() function returns the dimensions and location of the element as floating-point numbers after performing CSS transforms.

> console.log(document.getElementById('foo').getBoundingClientRect())
DOMRect {
bottom: 177,
height: 54.7,
left: 278.5,​
right: 909.5,
top: 122.3,
width: 631,
x: 278.5,
y: 122.3,
}


Related Topics



Leave a reply



Submit