开发者

set width for <a element in <td to 100%

开发者 https://www.devze.com 2023-02-04 19:07 出处:网络
is there any way to set the link element <a to 100% width开发者_运维知识库 inside a <td ???

is there any way to set the link element <a to 100% width开发者_运维知识库 inside a <td ???

thank you


A link <a> is inline element, you can't apply a width to it unless you make it block-level element:

#tableID td a{
   display:inline-block;
   width:100%;
}

The above selector will make all links inside td inside table with id #tableID block so that width is applicable.

Check out Inline and Block elements for more info


Give the <a> element display: block; and it will gain the full width of its parent.

Working demo: http://jsfiddle.net/sUT5e/

0

精彩评论

暂无评论...
验证码 换一张
取 消