Jump to content

CSS-Designed Table Help...?


mattvit

Recommended Posts

I know I'm pushing it here, haha, but I was hoping for CSS help!  :confused::D I hate to say it, but I copied this CSS from here: http://www.red-team-design.com/feature-table-design-with-css3

 

I did this partly because I am colorblind, partly because I know little CSS.

 

So the problem is, this CSS seems to cause the table to stretch/spread across the entire length of the page. (Well, across the content area, which is 900px, but that's irrelevant).

 

Here's the code:

 

.features-table
{
  width: 100%;
  margin: 0 auto;
  border-collapse: separate;
  border-spacing: 0;
  text-shadow: 0 1px 0 #fff;
  color: #2a2a2a;
  background: #fafafa;
  background-image: -moz-linear-gradient(top, #fff, #eaeaea, #fff); /* Firefox 3.6 */
  background-image: -webkit-gradient(linear,center bottom,center top,from(#fff),color-stop(0.5, #eaeaea),to(#fff));
}

.features-table td
{
  height: 50px;
  line-height: 50px;
  padding: 0 20px;
  border-bottom: 1px solid #cdcdcd;
  box-shadow: 0 1px 0 white;
  -moz-box-shadow: 0 1px 0 white;
  -webkit-box-shadow: 0 1px 0 white;
  white-space: nowrap;
  text-align: center;
}

/*Body*/
.features-table tbody td
{
  text-align: center;
  font: normal 12px Verdana, Arial, Helvetica;
  width: 150px;
}

.features-table tbody td:first-child
{
  width: auto;
  text-align: left;
}

.features-table td:nth-child(2)
{
  background: #efefef;
  background: rgba(144,144,144,0.15);
  border-right: 1px solid white;
}

.features-table td:nth-child(3)
{
  background: #e7f3d4;
  background: rgba(184,243,85,0.3);
}

/*Header*/
.features-table thead td
{
  font: bold 1.3em 'trebuchet MS', 'Lucida Sans', Arial;
  -moz-border-radius-topright: 10px;
  -moz-border-radius-topleft: 10px;
  border-top-right-radius: 10px;
  border-top-left-radius: 10px;
  border-top: 1px solid #eaeaea;
}

.features-table thead td:first-child
{
  border-top: none;
}

/*Footer*/
.features-table tfoot td
{
  font: bold 1.4em Georgia;
  -moz-border-radius-bottomright: 10px;
  -moz-border-radius-bottomleft: 10px;
  border-bottom-right-radius: 10px;
  border-bottom-left-radius: 10px;
  border-bottom: 1px solid #dadada;
}

.features-table tfoot td:first-child
{
  border-bottom: none;
}

 

I'd like to be able to control the table width with the table tag, ie <table class="features-table" width=200>, but it won't allow me.

 

Thanks, I know this is a PHP forum but I thought someone may still be able to help :)

 

 

edit: I have tried changing things around, mainly guesswork, and tried looking up some CSS (not much) so I haven't just copied and pasted the code straight to here!! :) )

Link to comment
https://forums.phpfreaks.com/topic/245214-css-designed-table-help/
Share on other sites

Thankyou, that worked perfectly! Really appreciate it!  :D

 

Haha and I know - I thought, "there's gotta be a CSS whizz here somewhere..!"

This is the css forum  8) We also have a html, javascript server etc forum. And yeah all under the roof of phpfreaks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.