.
Previous Next

Interview Questions on HTML

21. How to write comments in HTML?

In b/w <! - - and - - >

22. How to write tables in html?

By using <table>,<tr>,<td> or <th>tags.
Ex:-
<table style="width:100%">
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>

Explanation:
Tables are defined with the <table> tag.
Tables are divided into table rows with the <tr> tag.
Table rows are divided into table data with the <td> tag.
A table row can also be divided into table headings with the <th> tag.

23. How to do colspan in tables in HTML?

<table style="width:100%">
<tr>
<td colspan=”2”>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>

<td>Jackson</td>
<td>94</td>
</tr>
</table>

24. How to do row span ?

<table style="width:100%">
<tr>
<td rowspan=”2”>Jill</td>
<!—second cell also it will occpy - - >
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>

25. Can we use rowspan and colspan in <tr> tag?

No, only in <td> tags.

26. How to align text to right side in tables?

Use align=”right” attribute.
<td align=”right”>Jill</td>

27. How to collapse all borders of cells into single line border?

Use this in styles : border-collapse: collapse;

28. How to write ordered list and how to write un-ordered lists?

Ordered lists:-
<ol style="list-style-type:disc">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>

Un ordred lists :-
<ul style="list-style-type:disc">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>

29. How to remove bullets in unordered lists?

Use style attribute list-style-type:none

30. How to assign letters as serial numbers in ordered lists?

Use style type=”A”
Ex :-
<ol type="A">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>


Previous Next