February 1, 201115 yr 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!
February 1, 201115 yr 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 February 1, 201115 yr by jay pick
February 1, 201115 yr 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