Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rounding the corners of html table body

Here is a fiddle

My attempt to round the corners of a tbody element has been unsuccessful.

I was able to round the corners of a tr element in the tbody with the following

CSS

.tr .rounded-corners {

  height: 225px;
  width: 250px;
  display: inline-block;
  padding: 10px;
  margin-top: 10px;
  box-shadow: 2px 2px 7px #888888;
  border-radius: 7px;
  cursor: pointer;
  cursor: hand;
}

However, when I try to do a similar style with tbody the corners are not rounded?

.tbody .rounded {

  background: red;
  border-radius: 7px;
}

The background does appear red.

like image 223
ma77c Avatar asked Dec 22 '14 03:12

ma77c


2 Answers

If your table is set to border-collapse: separate (the default) then the border radius may, or may not be applied to the <tbody>, depending on the browser; the behaviour is undefined in the specifications.

According to the specs — CSS Backgrounds and Borders Module Level 3 (emphasis mine):

The effect of border-radius on internal table elements is undefined in CSS3 Backgrounds and Borders, but may be defined in a future specification. CSS3 UAs should ignore border-radius properties applied to internal table elements when ‘border-collapse’ is ‘collapse’.

For consistent results, based on your example, you would have to set the tbody to display: block as suggested in this answer. This will break the table behaviour somewhat, but could be useful.

like image 64
misterManSam Avatar answered Oct 19 '22 22:10

misterManSam


try this.,

.bodytable {
  background:blue;
  border-radius: 7px;
  display: inline-block;
}
like image 24
Sathish Avatar answered Oct 19 '22 23:10

Sathish