I'm having a problem with my HTML. I've searched all over the internet, but still no real answer.
I have a website with some images, and I want them to be in the middle. Now, on my screen they're in the middle, but that's because I've put them there by moving them to one side. When my friends to look at it, the image is off-center.
Here's the website; if you are on a 13.5" screen it will look to be in the middle.
Use a container element and set a specific max-width . A common width many websites use is 960px. To actually center the page, add margin: auto .
Step 1: Wrap the image in a div element. Step 2: Set the display property to "flex," which tells the browser that the div is the parent container and the image is a flex item. Step 3: Set the justify-content property to "center." Step 4: Set the width of the image to a fixed length value.
Using Text-align property Another way to align image to the left, centre or right of the page is to use the text-align property. The html code uses the <div> tag and inline CSS style. The following are examples of how to align an image to the left, centre and right. Image will follow the left alignment of text block.
Try something like this...
<div id="wrapper" style="width:100%; text-align:center"> <img id="yourimage"/> </div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With