且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

当内容超宽时(超出屏幕),CSS自动扩展页眉和页脚div宽度以匹配内容div宽度

更新时间:2023-11-30 20:35:22

您可能想尝试使用jQuery进行这种尺寸匹配.

You might want to try using jQuery for this kind of size-matching.

使用jQuery,您只需抓住内容div的宽度,并仅在加载页面时更改页眉和页脚的宽度.

With jQuery you simply grab the width of the content div, and change both the header and footer widths just when the page is loaded.

    $('#header,#footer').width($('#content div').width());

http://jsfiddle.net/z4hegp1o/4/