Bug Tracker

Opened 14 years ago

Closed 12 years ago

Last modified 11 years ago

#4869 closed bug (worksforme)

ie & Firefox: setting a div's width to its own current width will cause text content to wrap

Reported by: patrickwhalen Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.3.2
Keywords: firefox width text wrap Cc:
Blocked by: Blocking:


  1. Create a div that is floated left (or has some other css attribute that will cause its width to reduce to its content).
  1. Place a sentence of text inside the div.
  1. Get the div's width. var theWidth = $('#myDiv').width();
  1. Set the div's width to the value retrieved in step 3. $('#myDiv).css({width: theWidth});

Firefox result: Even though the width of the div hasn't changed, the text will wrap as though the div has been reduced in width. Tested Firefox 3 and 3.5 on mac os x.

ie result: The width of the div reduces each time by the size of the left and right borders. As though when getting the width, it subtracts out the border, so that when setting the width with that size, it is actually reducing it by the amount that was subtracted out. Tested ie 7 & 8 on xp.

webkit and opera are not affected.

Attachments (1)

width_anomalies.html (1.7 KB) - added by patrickwhalen 14 years ago.

Download all attachments as: .zip

Change History (2)

Changed 14 years ago by patrickwhalen

Attachment: width_anomalies.html added

comment:1 Changed 12 years ago by dmethvin

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.