Jump to content

CSS in td not working...


Go to solution Solved by Jim R,

Recommended Posts

When I had the output in DIV, the styling worked.  As I moved it to a table, it quit working.  Nothing else has changed, so there shouldn't be any conflicts, but I have tried !important.  

HTML:

echo '<td><span class="ranking">'. $line['rankClass'] . $line['devClass'] .'</span></td>

CSS:

.ranking {

	font-size: 24px;
	padding: 0px 10px 10px 5px;
	color: #FFF; 
	background-color: #5472D2;
	border-radius: 5px;
	padding: 5px;
	
}

 

Link to comment
https://forums.phpfreaks.com/topic/316043-css-in-td-not-working/
Share on other sites

You have padding set twice, you should delete one of them.  Otherwise, it seems to work fine if I copy/paste it into a jsfiddle test.

Use your browsers developer tools to inspect the element, it should tell you what styles are applied, and if some aren't, why.

I deleted the extra padding.  It's still not working.  

 

The numbers should be in a gray rounded box and should be white.  That's what they were in the previous iteration.  I'm updating this part of the site, so just making sure it's being applied before I dig in.  

 

image.thumb.png.006847b96f3c7909f9c192926cf94929.png

It looks like it's taking table styling from the core style sheet, but that's why I tucked all my custom stuff in <span>.  None of my CSS is even shown as not being used.  It all worked before I tucked it into a table.

 

(I'm using a table because I can't ever get grid styling to work as cleanly as I would like.)

Since we can't see whatever these core styles are, there nothing else really to say other than what you posted so far works fine.  You need to post more details about the code and styles being used to get more help.  If there is a URL to your page we could visit, that be best, otherwise provide the relevant styles and maybe a screenshot of the browser's dev tools when inspecting the span.

28 minutes ago, Jim R said:

I'm using a table because I can't ever get grid styling to work as cleanly as I would like.

A table is the correct thing to use when you have a table of data, which it seems like you do. 

That URL is redirecting to a registration page, and I'm not going to register to help fix a bug.

If you still want to provide a URL but not have to mess with the setup much, my suggestion would be to just save the output of your script into a static .html file somewhere.  As long as it's loading the same stylesheets and showing the same issue, it's enough to help.  When the problem is fixed you can simply remove that file. 

Alternatively, try and re-create the issue in jsfiddle and provide a link to that.

  • Like 1
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.