3 Replies - 440 Views - Last Post: 28 November 2009 - 08:06 PM

#1 sudhakararaog  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 65
  • Joined: 14-August 09

question about floating

Posted 25 November 2009 - 08:25 PM

i have a simple question, for example i have a link at the left edge of a div and link at the right edge of a div, a typical example would be at the footer.

what i normally do is take 2 divs and float them and set text-align: right for the 2nd div

#left{
float: left;
width: 500px;
height: 10px;
}

#right{
float: left;
width: 400px;
height: 10px;
text-align: right;
}


now in the left and right div i add the links 1 in left and 1 in right, all this works fine

however because its a small thing i was wondering if there is a much more simple way to do this instead of taking 2 divs and floating them and for the next content clearing needs to be used.


1.
i guess i can use 2 p tags however i have to set them to display: inline which might not be ideal i guess

2.
take 2 a tags and give them separate class names and set one class to float: left and the other to float: right



is there a much better and efficient way to achieve this effect apart from the 2 methods i mentioned above and using 2 divs and floating them.

thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: question about floating

#2 madskillz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 09-November 09

Re: question about floating

Posted 25 November 2009 - 11:13 PM

View Postsudhakararaog, on 25 Nov, 2009 - 07:25 PM, said:

i have a simple question, for example i have a link at the left edge of a div and link at the right edge of a div, a typical example would be at the footer.

what i normally do is take 2 divs and float them and set text-align: right for the 2nd div

#left{
float: left;
width: 500px;
height: 10px;
}

#right{
float: left;
width: 400px;
height: 10px;
text-align: right;
}


now in the left and right div i add the links 1 in left and 1 in right, all this works fine

however because its a small thing i was wondering if there is a much more simple way to do this instead of taking 2 divs and floating them and for the next content clearing needs to be used.


1.
i guess i can use 2 p tags however i have to set them to display: inline which might not be ideal i guess

2.
take 2 a tags and give them separate class names and set one class to float: left and the other to float: right



is there a much better and efficient way to achieve this effect apart from the 2 methods i mentioned above and using 2 divs and floating them.

thanks.


Hi thats apparently the best way unless you want to use tables.
Was This Post Helpful? 0
  • +
  • -

#3 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon



Reputation: 1335
  • View blog
  • Posts: 3,398
  • Joined: 28-November 09

Re: question about floating

Posted 28 November 2009 - 03:58 PM

@madskillz - Never use tables for anything but data.

@op - That would probably be the best way to do it.
Was This Post Helpful? 0
  • +
  • -

#4 3G Alarm  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 31-May 09

Re: question about floating

Posted 28 November 2009 - 08:06 PM

you already have every thing wired and ready to go m8
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1