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
Share on other sites

You have to change the width from 100% to 200 px in the .features-table style. The width of .features-table td might force it to be bigger though.

 

Or you could just wrap the table in a 200 px div container.

 

BTW - Not PHP!

Link to comment
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.