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.

if <center> is deprecated, what should we use?

Featured Replies

Hi

 

I've read somewhere that the CSS code for centering,

<center></center>

is deprecated.

 

So what should we be using instead?

 

I understand there is a code for centering text, which I forgot but is something like

text-align=center

or something. What is it exactly?

 

Also, what about centering things other than text, like images?

defo text-align:center;

 

if you want to centre a div then margin:0 auto;

 

It's not good practice to just put this is a style on the page. Allways place any ccs code in a stylesheet wherever possible.

 

Take a look at:

 

CSS Basics

 

Regs,

Numb

Bear in mind you also need to specify width if you're going to centre with margin:0 auto;

 

:)

Should be

 

<div style="margin:0 auto; width:55%">Hello Notbanksy</div>

 

Note the ; after auto.

  • Author

Yay, that does it bocaj :)

 

Also it seems that for it to be centered more exactly, the best is to set width at 0px, at least on my screen.

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.