Jump to content

My dad has his own company and the website sucks so to be nice I decided to start on a new website for him and when trying to add in a picture I just can't get the picture to be in the middel of the page, here is my code.

 

<html>
<img src="LOGO.png" width="900" height="200" alt=LOGO align="middle" />

 

What is wrong?
 

 

Link to comment
https://linustechtips.com/topic/595960-cant-get-image-to-centre/
Share on other sites

Link to post
Share on other sites

Vertical align tells how to align image to text. I guess you want to create some sort of welcoming page with enter button?

I made one example very quick using display table:

https://jsfiddle.net/Mr_KoKa/nmtkyq35/

 

and one I found and adjusted to your needs:

http://jsfiddle.net/Mr_KoKa/03r80emd/

This one uses helper inline-block element, it's inline so you can align your other inline(-block) against (img) and you can adjust it's height so your inline helper is 100% height and your image is aligned against it to middle, there is white-space no-wrap so it wont collapse when screen is narrow enough so image wont fully fit.

Link to comment
https://linustechtips.com/topic/595960-cant-get-image-to-centre/#findComment-7744400
Share on other sites

Link to post
Share on other sites

just wrapping it in a div and setting margin to auto and a width for the div should centre it.

 

<div class="centre">
    <img src="https://steamcdn-a.akamaihd.net/steam/apps/265930/header.jpg" />
</div>
.centre
{
  margin: 0 auto;
  width: 100px;
}

 

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
https://linustechtips.com/topic/595960-cant-get-image-to-centre/#findComment-7746520
Share on other sites

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×