HomeОбразованиеRelated VideosMore From: LearnWebCode

How to Center an Image Horizontally (CSS & HTML Tutorial)

571 ratings | 85836 views
In this video we look at two of the most popular techniques to center images. Check out my "Get a Developer Job" course: https://www.udemy.com/git-a-web-developer-job-mastering-the-modern-workflow/?couponCode=YOUTUBE-HALF-OFF Have you created amazing pages with HTML & CSS and want to move them from your computer’s hard drive to online so the world can see them? The next step is to move your files to a web host. Learn about web hosts, my favorite hosting company, and how to save $40 on the only hosting plan you’ll need: http://learnwebcode.com/web-hosting/ Sign up for my newsletter to receive periodic webDev tips, tricks, resources and coupons. Join the list at http://learnwebcode.com/ Follow LearnWebCode on Twitter for resources and updates: https://twitter.com/learnwebcode
Html code for embedding videos on your blog
Text Comments (68)
Don Fierro (16 days ago)
no, Thank You my friend! =)
Lawrence Maluki (20 days ago)
EnigmatikNeko (1 month ago)
THANK YOU!!! I had a code handed to me that gave me margin-left: auto and margin-right: auto from w3schools however it was not working. anyone knows why?
js singh (2 months ago)
helped me a lot
js singh (2 months ago)
Comix 23 (3 months ago)
It feels a lot of writing but working
Dragonite (4 months ago)
Thank you!
Moon Lovely (4 months ago)
Thank you so much! You helped me with my project! :D
Brenda Motta (5 months ago)
o único que me ajudou mesmo, obrigada
Deron Sobers II (6 months ago)
great video ! very helpful!
王景儀 (7 months ago)
David Anthony Batten (7 months ago)
But why use such a long way around method?
Wylted 1 (8 months ago)
Literally none of those options worked for me
Paul Elksnis (8 months ago)
This has bugged me for AGES and you have explained it perfectly in less than 5 minutes!!!!! THANK YOU!!! :)
Critical Hacker (9 months ago)
Thank you it really helped me! I didn't know you could use "text-align: center" on an element that is not a paragraph/text.
Just Saiyan (10 months ago)
You're my hero
One Bad Hombre (10 months ago)
You're a great teacher!!
Harry Blackwood (11 months ago)
Thanks dude, this really helped :)
Sinner 02 (1 year ago)
Thanks!! I was looking for this problem for a loooong time then i saw your video... It really helped
GunRhymes Media (1 year ago)
Thaaaaaank youuuuuuuu!!!!!!!!
Osman Halifa (1 year ago)
Thanks man, this really helped
Patrícia Ribeiro (1 year ago)
Dude, your videos are awesome. They're helping me alot. Thanks! and congrats for the great content;
Nicholas Gomez (1 year ago)
Thank you
Tyson Johnson (1 year ago)
Mine still won't center... I have to use an inline-block.. does that change things?
Danny BRITZMAN (1 year ago)
For some reason first method does not work (maybe its different in newer versions?) But the first one works perfectly. Thanks! gotta remember this for next time now.
Petrit Salihu (1 year ago)
thankyou so much !
Rohan Singh (1 year ago)
Thank you so much
Spy4er (1 year ago)
I love your videos. Thank you very much!
Kenjibaby (1 year ago)
FUT Mentor (1 year ago)
Awesome man thanks
Rupesh Vaingankar (2 years ago)
Thanks :)
Code-Grammar (2 years ago)
Thanks dude!
mrhockeypro97 (2 years ago)
Thank You!
Salty Shotgun (2 years ago)
thankyou this helped a lot
WattsUpStudios (2 years ago)
Munchkin (2 years ago)
Thank you so much
Daniel Mannawarajan (2 years ago)
Jad Sayegh (2 years ago)
Great videos. Bite sized and gives just the right amount of detail.
BlackKnight_007 (2 years ago)
thx bro nice video you saved me!
Jebediah's Lab (3 years ago)
I need the picture to be in the center with text flowing around it.. Help!
Majed Wabbi (1 year ago)
I know I'm late but set the position to absolute.
Lauren Shepherd (1 year ago)
Jebediah's Lab same :(
felly fell (3 years ago)
will this work in the figure tag?
Renzo Beronilla (3 years ago)
great tutorial. thanks
TheSecondAntagoniser (3 years ago)
Nice tutorial and very informative.
FIRE PRINCE (3 years ago)
thank you! i can set iamge in the center finally :)
Robert Chhangte (3 years ago)
simple and clear..thanks
Ernest Watson (3 years ago)
NAT T (3 years ago)
Thank you so much, you make explain it so clearly. :D
John C (3 years ago)
Awesome! Thanks for the simple and to the point explanations!
Ben Dover (4 years ago)
great video, thanks so much!!
Spoky (4 years ago)
Anyone know what program he's using for this? I'd rather not use notepad.
Calvin Pedersen (3 years ago)
+Hylan143 U should use sublime, it is an awesome program!
Chaib Ahmed (4 years ago)
thank's that's was helpful i use it for my website
Jonathan Bell (4 years ago)
Thanks, I've used this for my websites. You've now earned a new subscriber :)
Brendan Campbell (5 years ago)
Anyone tell me why you would use one option over the other? Is the block element one just better if you want to have the image in a very particular area of the page? 
george0700 (5 years ago)
maaaan this man is GUNIUS I learn a lot from this his my teacher 
Lil Huck (5 years ago)
Thanks. Very nice vid
Ken Olson (5 years ago)
Awesome bro thanks(: just started learning HTML today and got so many other options offered of which none of them worked. Thanks again
roroleeeen (5 years ago)
simple and easy! thnx for the toturial
Nathan Burtenshaw (5 years ago)
Thank you so much you saved my ICT assessment
biteTHEretard (5 years ago)
Thank you! You're a GOD!!!!!
Jeremy K. (5 years ago)
Bless your heart for making this so clear!
Cutty Flam (5 years ago)
thank you very much for sharing this
Prasanna Tilakaratna (5 years ago)
i have looked every where for this basic advice, yet amazingly, it was only your video that made things crystal clear. thank you.
Hussam Sibai (5 years ago)
was helpful ..thankyou ;
Andrius St (6 years ago)
aaand How to Center an Image Verticaly?
Paul Elksnis (6 years ago)
and mine!!!!
MickJnr7 (6 years ago)
My favorite channel on youtube

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.