Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5
check this one read the article i included in my previous answer https://code.sololearn.com/WgFX2P2vF6eS/?ref=app
23rd Aug 2017, 6:33 AM
Lord Krishna
Lord Krishna - avatar
+ 5
@Tams you need to use CSS for positioning images. the picture may not matter much in itself.
23rd Aug 2017, 6:38 AM
Lord Krishna
Lord Krishna - avatar
+ 4
update: check this website it gives simple ways to center elements using css https://www.thoughtco.com/center-images-with-css-3466389 check my code using flexbox note: need to know flexbox for this. https://code.sololearn.com/WziX0fcfZqfe/?ref=app
23rd Aug 2017, 6:04 AM
Lord Krishna
Lord Krishna - avatar
+ 4
@Tams referring to me? what didn't work exactly though?
23rd Aug 2017, 6:15 AM
Lord Krishna
Lord Krishna - avatar
+ 4
@Sam your method works when you remove left, right. check the code i tried that method
23rd Aug 2017, 6:43 AM
Lord Krishna
Lord Krishna - avatar
+ 1
<img src="pic.jpg" style="position:absolute; left:50%;"> there us more to it and many other ways to get it done but this may help
23rd Aug 2017, 6:00 AM
Sam Tezel
Sam Tezel - avatar
+ 1
memory bad on this sorry....but the css by Lord is what I was trying to remember and it works
23rd Aug 2017, 6:44 AM
Sam Tezel
Sam Tezel - avatar
+ 1
for inline styling ... <img style="display:block; margin-left:auto; margin-right:auto " src="https://images.duckduckgo.com/iu/?u=https%3A%2F%2Ftse2.mm.bing.net%2Fth%3Fid%3DOIP.lXr2G1w-QlFDCDTTgJIzEAEsC7%26pid%3D15.1&f=1" height="150px" width="150px" border="1px" alt="some pic"/>
23rd Aug 2017, 6:51 AM
Sam Tezel
Sam Tezel - avatar
0
my memory is not perfect on this but....you need to move the pic to center using left or margin-left .....if you page is a fixed width like 1000px then you would use, if I remember correctly, left to the edge of the begining of your pic....so if pic is 200px wide you would use left:400px and right:400px making the total px width 1000 in this case....can't remember well so it might be margin-left etc
23rd Aug 2017, 6:16 AM
Sam Tezel
Sam Tezel - avatar
0
sometimes putting the pic in a div first is needed and then style div
23rd Aug 2017, 6:17 AM
Sam Tezel
Sam Tezel - avatar
0
if it works and you need it to apply to different screen sizes then use @media in css
23rd Aug 2017, 6:19 AM
Sam Tezel
Sam Tezel - avatar
0
<div style="position:relative; left:30%; right:70%"><img class="p" src="boxcake.jpg" height="150px" width="150px" border="1px" alt="some pic"/></div>
23rd Aug 2017, 6:36 AM
Sam Tezel
Sam Tezel - avatar