让div自动填充空间
所以我一直试图解决我的 div 的问题;如何将我的设计转化为实际布局,我在研究或实施方面运气不佳。在附加的链接中,您可以看到 //PORTFOLIO,然后是一条延伸到内容区域边缘的线,其中有一条红线。现在我将 //PORTFOLIO 和红线 div 设置为特定的像素宽度,但我希望能够让两个 div 自动设置其宽度(第一个根据 // 的多少自动设置其宽度) TITLE 占用,第二个填充容器中的剩余空间),因为我会让网站的其他部分做同样的事情,并且不想专门针对每个区域进行测量。欢迎任何建议,非常感谢!
So I've been trying to figure out an issue with my divs here; how to translate my design into the actual layout, and I've not had much luck with research or implementation. In the attached link, where you see //PORTFOLIO and then a line extending to the edge of the content area, there's a red line. Right now I have both the //PORTFOLIO and red line divs set to a specific pixel width, but I want to be able to have both divs auto-set their width (the first to automatically set its width based on how much the //TITLE takes up, and the second to fill the remaining space in the container) since I'll have other sections of the website doing the same thing, and don't want to measure specifically for each area. Any suggestions are most welcome, thank you so much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
参见: http://jsfiddle.net/GmtMK/1/ < em>(改变浏览器窗口的宽度)
See: http://jsfiddle.net/GmtMK/1/ (change the width of the browser window)
首先,让我在你的网站上补充一下你的网站,它看起来又漂亮又时尚!
其次,我为您提供了一个解决方案,使用
display: table
css 属性,但是,它需要添加
元素,但它不允许您这样做单元格高度不均匀:请参阅完整示例:http://jsfiddle.net/GmtMK/
First, let me complement you on your website, it looks nice and stylish!
Secondly, I have a solution for you, using
display: table
css property, however, it requires adding an<hr />
element is it won't let you have cells of uneven height:Please see full example: http://jsfiddle.net/GmtMK/