Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Float or Position? 2/3 Columns CSS

  • 05-07-2011 02:44PM
    #1
    Registered Users, Registered Users 2 Posts: 23,641 ✭✭✭✭


    I am floating most of my columns but just wondering is it easier to use positioning for columns to insure that they are equidistant from each other?

    Or how do I keep my columns equidistant using floats?


Comments

  • Registered Users, Registered Users 2 Posts: 8,070 ✭✭✭Placebo


    float and margins?


  • Registered Users, Registered Users 2 Posts: 23,641 ✭✭✭✭Elmo


    Placebo wrote: »
    float and margins?

    I use margins, but find that its always a little off :( is there a way of get the column exact?

    But avoid positioning for this right?


  • Registered Users, Registered Users 2 Posts: 8,070 ✭✭✭Placebo


    you could always have a wrapping div and then use position absolute/relative.
    However i dont see how margins can be a little off? you're in control at a per pixel rate

    post up your code/link


  • Registered Users, Registered Users 2 Posts: 23,641 ✭✭✭✭Elmo


    Placebo wrote: »
    you could always have a wrapping div and then use position absolute/relative.
    However i dont see how margins can be a little off? you're in control at a per pixel rate

    post up your code/link

    Yeah worked it out, from your question, I was using % in the CSS file for each div tag and setting them each at 30%, I am now being specific using px and taking into account the padding and margins used, this has worked e.g.
    #div1  {
    	width: 308px;
    	float: right;
    	padding: 5px;
    	overflow: auto;
    	height: 310px;
    	background-color: #FFF;
    	position: relative;
    	margin-top: 5px;
    	margin-bottom: 5px;
    	margin-left: 5px;
    }
    
    #div2 {
    	width: 308px;
    	float: right;
    	padding: 5px;
    	height: 310px;
    	background-color: #FFF;
    	position: relative;
    	margin-top: 5px;
    	margin-right: 5px;
    	margin-bottom: 5px;
    	margin-left: 5px;
    }
    
    
    #div3 {
    	width: 308px;
    	padding: 5px;
    	height: 310px;
    	float: left;
    	background-color: #FFF;
    	position: relative;
    	margin-top: 5px;
    	margin-right: 5px;
    	margin-bottom: 5px;
    }
    
    
    
    Body is set to 980px

    Q. Can you use absolute positioning in a class?
    .class {	
    	position: absolute;
    	top: 0px;
    	right: 0px;
    	width: 100%;
    }
    


  • Registered Users, Registered Users 2 Posts: 23,641 ✭✭✭✭Elmo


    Seems you can. Thanks again for everyone's help :) Sometimes I just need to ask questions to get me thinking.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 125 ✭✭ivanc


    Elmo wrote: »
    Body is set to 980px
    [/code]

    Have you looked at the 960 Grid System? Takes care of a lot of positioning issues with fixed width sites.

    http://960.gs/


Advertisement