开发者

Wrapping a table or DIVs columns to multiple rows

开发者 https://www.devze.com 2023-01-02 20:22 出处:网络
I\'m working with a CMS that parses variables into content using placeholders, e.g. <td> [[TITLE]]

I'm working with a CMS that parses variables into content using placeholders, e.g.

<td>
[[TITLE]]
<br />
[[DESCRIPTION]]
</td>
开发者_运维问答

The problem is that this will make one long table row. Because of the way the code is written, I can't get it to insert a <tr> after every few columns. Is there any way to wrap the rows (even using DIVs to emulate tables)?

Even any jquery/mootools/prototype features that could be adapted to do this?


Found the solution: Use <ul> and <li> styled with CSS and put a <div> around it.

Short example:

<style>
#nav-menu li
{
    height: 20px;
    float: left;
    width: 100px;
    display: block;
    border: 0.1em solid #dcdce9;
    color: #0d2474;
    text-decoration: none;
    text-align: center;
} 
#nav-menu ul
{
    list-style: none;
    padding: 0;
    margin: 0;
} 

#nav-menu {
    /* You can change this width and the list will wrap */
    width: 400px;
    border: 1px solid red;
}

</style>

<div id="nav-menu">
    <ul>
    <li><a href="#">Services</a></li>
    <li><a href="#">About us</a></li>
    <li><a href="#">Contact us</a></li>
    <li><a href="#">Services</a></li>
    <li><a href="#">About us</a></li>
    <li><a href="#">Contact us</a></li>
    <li><a href="#">Services</a></li>
    <li><a href="#">About us</a></li>
    <li><a href="#">Contact us</a></li>
    </ul>
</div> 


As for JQuery and tables there are plenty of options on the 'table'.

http://webdesignledger.com/resources/12-useful-jquery-plugins-for-working-with-tables http://plugins.jquery.com/project/Plugins/category/54

0

精彩评论

暂无评论...
验证码 换一张
取 消