/    Sign up×
Community /Pin to ProfileBookmark

remove gap between table cells also using CSS

in a table would like to display text as below in one of it’s cell and also have a same background for the whole block which will be the tablecell. Have other stuff displaying in other cells.

sample — bold
This is a sampe text

tried to do the same by using the below code

<tr >
<td>
<tr>
<td class=”bold-label” >
<bean:message key=”lbl.sample”/>
</td>
</tr>
<tr>
<td class=”label-Table” >
<bean:message key=”lbl.sampledesc”/>
</td>
</tr>
</td>
</tr>

In the css file

.bold-label{
border: 0;
border-width: 0;
padding: 0.3em;
vertical-align: top;
text-align: left;
font-family: Times New Roman;
font-size: 12px;
font-weight: bold;
padding-bottom: 0px;
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;
background: #D3D3D3;
}

.label-Table {
border: 0;
border-width: 0;
padding: 0.3em;
vertical-align: top;
text-align: left;
font-family: Times New Roman;
font-size: 14px;
font-weight: Normal;
padding-bottom: 0px;
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;
background: #D3D3D3;
}

I did give the border as none. But still getting a gap between rows i.e between the text Sample and the message below it.

I know I try using the <p>. But trying to do this only using the table. how can this be done using tables?

I would appreciate your help. thanks.

to post a comment
HTML

2 Comments(s)

Copy linkTweet thisAlerts:
@kelly23Oct 31.2005 — <table class="gray">

and in your css:

table.gray {background: #D3D3D3}

This make the background of the whole table gray with no colored gaps between cells or rows. (You won't need to specify the background color of the td's if you have the table background color set (unless you want different colors than the table).
Copy linkTweet thisAlerts:
@BonRougeNov 01.2005 — table {
border-collapse:collapse;
}
×

Success!

Help @Rxyz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...