How to define the width and the height of table in html?
How to define the width and the height of table in html?
How to define the width and the height of table in html? and how to change the color and font size of that link(covered font with green),
I would like to let pages beautiful, project_list.html as below, thank you so much for you help:
{% extends 'base.html' %}
{% block content %}
<nav aria-label="breadcrumb">
</nav>
<h3 class="mb-3">我学习的课程列表</h3>
{% for course in courses %}
{% empty %}
{% endfor %}
课程序号 课程名称 部门名称 课程日期 课程时间 {{ course.pk }} {{ course.name }} {{ course.department.get_html_badge }} {{ course.date }} {{ course.time }} 目前没有你所选技能的课程。
<div class="card-footer">
.table .mb-0 { height: 400px; width: 50%;}
Boostrap Grid System
4 Answers
4
As for the width, I think the easiest option would be to define specific widths to the thead elements, something like
<thead>
<tr>
<th width="7%">课程序号</th>
<th width="47%">课程名称</th>
<th width="20%">部门名称</th>
<th width="10%">课程日期</th>
<th width="10%">课程时间</th>
<th width="6%"></th>
</tr>
</thead>
You can vary the width depending on the resulting table. Percentage widths are always tricky to adjust.
As for the height, it will adjust accordingly. I wouldn't recommend you to assign heights to rows as it would not adjust correctly if the content varies in length.
As for the link color I think the easiest would be something like:
<td class="align-middle" style="word-break: break-all;"><a href="{% url 'employees:course_detail' course.pk%}" style="color:blue;font-size:16px;">{{ course.name }}</a></td>
In case you use rem
or em
you could substitute the 16px
with the value you require.
rem
em
16px
Thank you so much for prompt answer, it works, thank you ❤️
– Begin2Pip
Jun 29 at 16:28
to change the width and height of table you can use colgroup in html. To chnage the colour just specify it in the style element.
<table>
<colgroup>
<col style="width:80px" />
<col style="width:80px" />
<col style="width:80px" />
</colgroup>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
Use percents, not pixels for example <td height="10%">Text</td> <td width="70%">Text</td>
. Percent will be depended on the surrounding element, you have to adjust it by your needs.
<td height="10%">Text</td> <td width="70%">Text</td>
To define width for a table you can use <table width="400">
this will change the table width in detail description given below.
<table width="400">
https://www.w3schools.com/tags/att_table_width.asp
And to change color of your link you can use something like this :
<body a link="black" vlink="red">
this might work for you : )
Isn't is body
alink
and not a link
? Also is it good idea to give width in numbers rather than in percentages?– Ravi Maniyar
Jun 30 at 5:16
alink
a link
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
.table .mb-0 { height: 400px; width: 50%;}
. UseBoostrap Grid System
to help with size issues.– Alex
Jun 29 at 16:03