Suppose we have a table in codeignaiter views / welcome_messege.php. Here is its code:

<table id="node" border="1" class="table-bordered"> <caption align="center"><h1><p class="text-primary">Список ссылок</p></h1></caption> <tr class="danger"> <td>id</td> <td>name</td> <td>url</td> <td>status</td> <td>delete</td> <td>edit</td> </tr > <?php foreach($url_list as $val) : ?> <tr class="success"> <td><?php echo $val->id; ?></td> <td><?php echo $val->name; ?></td> <td><?php echo $val->url; ?></td> <td><?php echo $val->status; ?></td> <td><button onClick="location.href='/welcome/delete/<?=$val->id?>';return false;">Delete‌​</button></td> <td><button>Edit</button></td> </tr> <?php endforeach; ?> <tr class="info"> <th></th> <th><input type="text" name="name1" size="10" maxlength="20"></th> <th><input type="text" name="url1" size="10" maxlength="20"></th> <th><input type="text" name="status1" size="10" maxlength="20"></th> <th><input type="submit" value="Add row"></th> </tr> </table> 

How to make so that the table was centered along with its title?

    1 answer 1

    It always helps margin:0 auto; or text-align:center;

    Although sometimes you need to add positioning absolute or dependent: position:absolute; or position:relative;