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.

Centralising Divs

Featured Replies

How do i centralise a div inbetween 2 other divs going across the width of the page.

 

Ive used the 2 outside edges using float, but how do i centralise the central one ?

 

Much Appreciated!

Well you can centralise divs in a container using margin:0 auto

 

If I were displaying 3 divs in a row next to each other however, I would use float:left on all of the divs and then use margin-right to achieve the spacing between each div. You can use a class if you only need to apply margin-right to the first two divs (which will most likely be the case).

 

You could even use absolute positioning as an alternative.

 

Hope this helps

Edited by jay pick

  • Author

Well you can centralise divs in a container using margin:0 auto

 

If I were displaying 3 divs in a row next to each other however, I would use float:left on all of the divs and then use margin-right to achieve the spacing between each div. You can use a class if you only need to apply margin-right to the first two divs (which will most likely be the case).

 

You could even use absolute positioning as an alternative.

 

Hope this helps

 

You know i never even thaught of that and ive seen it many of times but it never clicked. Im trying to avoid using absolute positioning as i cant centralise everything when re sizing windows etc, thats why i had to re code in the first place as i was using absolute positioning and inline styles O.o lol..

 

Thanks for the help :)

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.