4

I have a ul and I want to fix the width of the ul to content. Currently I use -moz-max-content but there is some problem in non-mozilla browsers.

How can I implement the -moz-max-content?

4

1 に答える 1

9

Use max-width: intrinsic;. This works for webkit browsers (Chrome & Safari).

Be aware that attributes starting with -moz are only working in Mozillas Firefox. The common prefixes are:

  • -moz for Firefox
  • -webkit for Webkit (mainly Chrome & Safari and a lot of the Chromium forks)
  • -ms for IE10
  • -o for Opera

As written at http://msdn.microsoft.com/library/ms530811.aspx you can only define pixels or percentage. The max-width property itself is supported since IE7.

It might be that you can use a max-width: 100%; for IE, but I'm unsure if the results are the same.

于 2012-06-06T13:06:17.770 に答える