javascript - Css: px doesnt have the same effect as % -
I am trying to create the status of an element in the center of the screen. When I use it:
this.css ("condition", "fixed"); this.css ("top", "50%"); this.css ("left", "50%");
this Works, but when I use
this.css ("condition", "fixed"); This.css ("top", $ (window). Light () / 2+ "px"); This.css ("left", $ (window) .wide () / 2+ "px");
this
Am I doing the wrong thing?
This is a donation code code:
. Donut-button {display: table; Height: 400 pixels; Width: 400px; Limit-Radius: 50%; Background: # cc 0000; Margins: Auto Auto; Status: Completed; Top: 0; Left: 0; Bottom: 0; Correct: 0; }. Donut-text {display: table-cell; Vertical-row: middle; Text align: center; Font-family: 'snuggle', cursor; Font-size: 100px; -webkit-user-select: none; / * Chrome / Safari * / -mose-user-select: none; / * Choose Firefox * / -MMS-User: None; / * IE10 + * / / * The rules given below are not yet implemented in the browser. * / -o-user-select: none; Select user: none; }
OK, I did not want to leave this unanswered: < P> I do not think you are reaching it correctly, please review this frustration to look at a simple approach that removes JS problems (and all JS, P: P) < p> .thing {status: absolute; Background: RGBA (100,100, 255,0,5); Height: 80px; Width: 120px; Top: 50%; Left: 50%; Margin-left: -60px; Margin-top: -40px; } .thing.left {OK: Auto; Left: -140px; Margin-left: 0; } .thing.top {top: -100px; Margin-top: 0; } .thing.right {fine: -140px; Left: auto; } .thing.bottom {top: auto; Bottom: -100px; } Actually keep your "things" in the container of the button, and place them according to its location :)
Comments
Post a Comment