简体   繁体   中英

How to style <td> items inside <table> tag?

I am using jsp with css for style the <td> inside <table> tag. I want the code like below:

在此处输入图片说明

But now I am getting :

在此处输入图片说明

 #bengalistorycontainer{ width:100%; } table.my-special-table { width: 10px; height: 10px; border: 1px rgb(89,89,89) solid; } 
 <table class="my-special-table"> <tr> <c:forEach begin="1" end="${classfile}" var="i"varStatus="loop"> <c:choose> <c:when test="${classfile eq i}"> <td>${1} </div></td> </c:when> <c:otherwise> <td><a href="#">${2}</a></td> </c:otherwise> </c:choose> </c:forEach> <c:if test="${totalpagenumber != 1}"> <td> <a href="#">next</a> </td> </c:if> 

jsfiddle

What am I doing wrong?

just edit your code to the following:

 #bengalistorycontainer{ width:100%; } table.my-special-table td{ width: 10px; height: 10px; border: 1px rgb(89,89,89) solid; } 
 <table class="my-special-table"> <tr> <c:forEach begin="1" end="${classfile}" var="i"varStatus="loop"> <c:choose> <c:when test="${classfile eq i}"> <td>${1} </div></td> </c:when> <c:otherwise> <td><a href="#">${2}</a></td> </c:otherwise> </c:choose> </c:forEach> <c:if test="${totalpagenumber != 1}"> <td> <a href="#">next</a> </td> </c:if> 

you did select the table, not the td element.. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM