What's the best way to convert table layout to CSS layout?

后端 未结 8 1934
故里飘歌
故里飘歌 2020-12-30 11:58

I\'m about to begin working on a web page with a complex table-based layout (coded years ago).

One of the things I\'d like to do is convert the layout to a proper CS

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-30 12:25

    In some cases, using regular expressions could speed up your process.

    For instance, something like this:

    \R*.*\R*.*]*?>(.*)
    

    would match the start of a table and provide the contents of the first cell in $1 for a replace:

    \n\t
    \n\t\t
    $1

    Of course you'd need to customize to match your particular use case. If you have a number of similar pages, you might try hand coding one first and then using something like this to make converting the others simpler.

    Another approach would be to use something like this jQuery plugin: https://github.com/ryandoom/jquery-plugin-table-to-div

    It is intended to modify following rendering, but could be used during development to take a given table and provide a simple DIV based form of it.

提交回复
热议问题