Can you do this HTML layout without using tables?

前端 未结 10 1114
心在旅途
心在旅途 2020-12-04 06:23

Ok, I had a simple layout problem a week or two ago. Namely sections of a page needed a header:

+------------------         


        
10条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-04 07:18

    Just float left and right and set to clear both and you're done. No need for tables.

    Edit: I know that I got a lot of upvotes for this, and I believed I was right. But there are cases where you simply need to have tables. You can try doing everything with CSS and it will work in modern browsers, but if you wish to support older ones... Not to repeat myself, here the related stack overflow thread and rant on my blog.

    Edit2: Since older browsers are not that interesting anymore, I'm using Twitter bootstrap for new projects. It's great for most layout needs and does using CSS.

提交回复
热议问题