Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Aligning middle and centre

Featured Replies

Hi all,

 

I am looking to align a table or an image in the middle of a web page. So no matter what resolution the viewer is using, or no matter if the page is resized, the image/table stays dead centre of the page, does that make sense and is it possible?

 

thanks

CSS:

 

#center { position: absolute; width: 300px; height: 200px; left: 50%; margin-left: -150px; top: 50%; margin-top: -100px; }

 

HTML markup:-

 

<img id="center" src="image.jpg" alt="image description">

 

The negative margins are always half the element size.

 

 

You can do the same with a table.

 

It works best with small widths and heights. If someone looks at it in a small window and the element is wider than the window the left side will disappear out to the left where you can't scroll to see it. Similarly if the height is too large it will disappear up over the top of the window.

 

See http://www.wickham43.net/centerphotolink.php

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.