duanli0162 2011-06-03 16:22
浏览 25
已采纳

带有div的CSS / PHP填充屏幕

I am trying to fill the screen with divs, and I'm thinking about using php to dynamically resize the divs based on the screen resoultion, so, for example, 16 divs always appear in each row.

Example of DIV spacing

Example A is the problem, in Example B I resize the divs to fit the screen.

So, is this efficient? I would have something like this for each background image of each div:

/bgimage.php?id=123456&resize=125

Where resize is calculated by dividing the browser width by 16, or the # of divs I want in each row.

I'm not sure about using this method, because I don't want the divs to appear to small if the resolution is very low.

Any other suggestions? Could this be done better using just CSS or javascript? The

  • 写回答

2条回答 默认 最新

  • douwen3965 2011-06-03 16:30
    关注

    I don't see why you need any scripting in any language?

    If you set every div to float left with a width of 6% then 16 divs will take up 96% of the width no matter what the screen is resized to. You can wrap them in another div with a 4% margin to handle the remaining 4%.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?