1

I have 3 <a> selectors in my <div>. I gave them fixed widths. But they are not stretching to correct widths. They are just stretching to fit to their containing data (texts). But I want them to divide my parent div to 3 cells and I want them to fill it using the assigned widths.

I am attaching an image below. the first image shows what I am getting now and the second image shows what I what.

enter image description here

Here is the fiddle.

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
Alfred
  • 21,058
  • 61
  • 167
  • 249
  • possible duplicate of [Does height and width not apply to span?](http://stackoverflow.com/questions/2491068/does-height-and-width-not-apply-to-span) – JJJ Jan 29 '12 at 10:13
  • Those are not selectors. Those are elements. – BoltClock Jan 29 '12 at 20:31

3 Answers3

4

use: display:inline-block;

jsfiddle Demo

also : use percents !

http://jsfiddle.net/j6kcJ/4/

latest :

http://jsfiddle.net/j6kcJ/5/

Royi Namir
  • 144,742
  • 138
  • 468
  • 792
  • this is useful, but how can I remove space in between them?? – Alfred Jan 29 '12 at 10:15
  • I think float-left is enough to do the work with percentages. Am I wrong?? – Alfred Jan 29 '12 at 10:23
  • float left is to take it to the most left , and percentage is to divide the with to be as you want. . you can also use fixed with if you measure it accurately – Royi Namir Jan 29 '12 at 10:27
1

Give the anchor elements a display value of inline-block and the width values will apply to them.

kinakuta
  • 9,029
  • 1
  • 39
  • 48
1

Just need to add this css style:

.xxx a {display:inline-block;float:left;}

Hope this helps

Sabari
  • 6,205
  • 1
  • 27
  • 36