次に要素のwidthをpx(ピクセル数)で指定してみましょう。pxはいわゆる絶対値の値になります。たとえば、width: 500pxと書けば、親要素に関係なく幅は500pxになります。 画像の幅をpxで指定してみよう. 所有主要浏览器都支持 width 属性。 注意:IE7 及更早的版本不支持 "inherit" 值。IE8 只有规定了 !DOCTYPE 才支持 "inherit"。IE9 支持 "inherit"。
However, when it gets focus, make it 250px wide:
浏览器支持. The width attribute specifies the width of the element, in pixels.The width attribute can be used on the following elements:A
By default, a browser will adjust table columns to fit the contents of the table. HTML5 do not support the width attribute of
, so the CSS property width is used with the style attribute to set table width. The width can be set either as an absolute value in pixels, or as in percentage (%). The width attribute, now deprecated, was once the correct way to adjust the width of a table’s columns. Examples might be simplified to improve reading and basic understanding. The width attribute specifies the width of a table or the width of a table cell.