How to ignore borders when positioning any element ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

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) .

11th Mar 2017, 9:54 AM
Utkαrsh
Utkαrsh - avatar
7 Answers
+ 9
box-sizing:border-box; box-sizing:content-box; could help you https://www.w3schools.com/cssref/css3_pr_box-sizing.asp experiment with this on your own, because I know you're pro so I won't tell you everything :)
11th Mar 2017, 10:07 AM
Kamil
Kamil - avatar
+ 8
@Utkarsh nicee bro i can't wait!!👌👌 a new code?😁
11th Mar 2017, 10:27 AM
Kamil
Kamil - avatar
+ 8
The code is here. Check out (Image Editor)🖼
11th Mar 2017, 5:18 PM
Utkαrsh
Utkαrsh - avatar
+ 6
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.
11th Mar 2017, 10:09 AM
Shehab Amr
Shehab Amr - avatar
+ 6
@kamil that worked perfectly .. you will soon find why I asked this question for 😉
11th Mar 2017, 10:26 AM
Utkαrsh
Utkαrsh - avatar
0
align="center" and body{ position=0; padding=0; }
11th Mar 2017, 10:11 AM
NedA
NedA - avatar
0
استایل بده به عکس <img src="/" style="margin:100px auto 0 auto"> <عکس منبع="/" استایل="فاصله:از بالا از راست از پایین از چپ"> اینم سورس با تحلیل
25th Apr 2017, 3:27 PM
Amin
Amin - avatar