Wykaz Posted July 28, 2022 Share Posted July 28, 2022 I noticed something that I find strange on the In the old versions the padding is included in the hitbox but in the new versions not. Is there a way to do as before in the new versions (to have a hitbox including the padding)? Am I the only one who thinks it was better before? Why is it like this now? old: new: See the Pen abYLRro by Wykaz (@Wykaz) on CodePen Thank you in advance for all your answers. See the Pen wvmrRja by Wykaz (@Wykaz) on CodePen Link to comment Share on other sites More sharing options...
Cassie Posted July 28, 2022 Share Posted July 28, 2022 Heya! It's dependant on the box-sizing property in CSS. if the box is set to box-sizing: border-box then the padding is taken into account. Not sure if that's by design or not. I'll leave that to @GreenSock to answer! content-box gives you the default CSS box-sizing behavior. If you set an element's width to 100 pixels, then the element's content box will be 100 pixels wide, and the width of any border or padding will be added to the final rendered width, making the element wider than 100px. border-box tells the browser to account for any border and padding in the values you specify for an element's width and height. See the Pen NWYwdbz by GreenSock (@GreenSock) on CodePen https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing 1 1 Link to comment Share on other sites More sharing options...
Wykaz Posted July 28, 2022 Author Share Posted July 28, 2022 16 minutes ago, Cassie said: Heya! It's dependant on the box-sizing property in CSS. if the box is set to box-sizing: border-box then the padding is taken into account. Not sure if that's by design or not. I'll leave that to @GreenSock to answer! content-box gives you the default CSS box-sizing behavior. If you set an element's width to 100 pixels, then the element's content box will be 100 pixels wide, and the width of any border or padding will be added to the final rendered width, making the element wider than 100px. border-box tells the browser to account for any border and padding in the values you specify for an element's width and height. https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing Thank you for your answer it will help me a lot. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now