How to ignore borders when positioning any element ? | Sololearn: Learn to code for FREE!


How to ignore borders when positioning any element ?

for example - I have an image with img{ position: absolute; left:10%; border:10px solid black; height:80%; width:80%; } I want the image in the center no matter if the border is removed or the width of the border has been changed (ignore the borders) .

3/11/2017 9:54:44 AM


7 Answers

New Answer


box-sizing:border-box; box-sizing:content-box; could help you experiment with this on your own, because I know you're pro so I won't tell you everything :)


@Utkarsh nicee bro i can't wait!!👌👌 a new code?😁


The code is here. Check out (Image Editor)🖼


you can use <center> tag in html by put your image between this tag or you can use margin-left in css to be the image in the center.


@kamil that worked perfectly .. you will soon find why I asked this question for 😉


align="center" and body{ position=0; padding=0; }


استایل بده به عکس <img src="/" style="margin:100px auto 0 auto"> <عکس منبع="/" استایل="فاصله:از بالا از راست از پایین از چپ"> اینم سورس با تحلیل