Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boxsizing.htc causes page elements in IE7 to shrink #38

Open
RossEmery opened this issue Jan 5, 2014 · 2 comments
Open

boxsizing.htc causes page elements in IE7 to shrink #38

RossEmery opened this issue Jan 5, 2014 · 2 comments

Comments

@RossEmery
Copy link

I have been experiencing a problem with page elements in IE7 shrinking inward from left and right when I use boxsizing.htc for border-box sizing of my float-based layouts.

Here is a similar report: Strange interaction with box-sizing-polyfill when window resized

(Sorry about all the closing and reopening of my issue. I thought the polyfill was working and then it wasn't.)

@RossEmery
Copy link
Author

I tried using boxsizing.htc for only the necessary elements (rather than global *) as advised my Schepp ( #12 ) but still experience shrinking in IE7 when I include this class (some .page's also include padding):

.page {
background-color:white;
border:1px #6666FF solid;
color:#000099;
font-family:Helvetica, Arial, sans-serif;
line-height:1.5;
margin:0.625em auto;
width:60em; }

As an alternative, I am getting good results for my float-based layouts using a simple jQuery script to adjust the box widths for the necessary elements:

/* Set border-box widths for IE6 and 7 */

$(function() {
var selectors = [ '.page', '#header-1', '#header-2', '#home-1', '#home-2', '#plan-refs-1', '#plan-refs-2' ];

$(selectors).each(function(i)
{
    var selector      = selectors[i];
    var content_width = $(selector).width();
    var border_width  = $(selector).outerWidth();

    if (content_width)
    {
        var new_content_width = content_width - (border_width - content_width);

        $(selector).css("width", new_content_width);
    }
});

});

@RossEmery RossEmery reopened this Jan 23, 2014
@AdamBoxall
Copy link

I was getting this problem when I was adding/removing a class on focus/blur, that was triggering the checkPropertyChange() function, which seems to cause the shrinking problem.

If the elements you will use the behaviour on will only ever be static (i.e. no bound events that could cause border/padding/content width changes) then you can somewhat safely remove the following line to remove the event binding:

<attach event="onpropertychange" onevent="checkPropertyChange()" />

Very limited fix of course because the width won't be updated to match elements changes, but it suited my needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants