Jump to content
  • 0

Выравнивание содержимого одной колонки таблицы


FSe®g
 Share

Question

Добрый день!

Помогите пожалуйста.

Имеется таблица 3 столбца 100 строк. Как выровнять по правому краю содержимое первого столбца? Через задание стилей тегу Col или Colgroup не получается.

 

<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {border: 1px solid black;}
th, td {width: 150px;}
.col1 {text-align:right; background-color:yellow}

</style>
</head>
<body>

<table>
  <colgroup>
    <col class="col1" />
    <col />
  </colgroup>
  <tr>
    <th>ISBN</th>
    <th>Title</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>3476896</td>
    <td>My first HTML</td>
    <td>$53</td>
  </tr>
  <tr>
    <td>5869207</td>
    <td>My first CSS</td>
    <td>$49</td>
  </tr>
</table>

</body>
</html>

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy