CSS on my note affects the whole screen
Moderators: Public Relations Department, Players Department, Programming Department
- Swingerzetta
- Posts: 615
- Joined: Mon Feb 11, 2013 11:21 pm
CSS on my note affects the whole screen
I have a note in which I use a <style> tag to change the style of td and th elements, and, in particular, makes the background of td's white. When I view this note, I notice that the top of the page, and several other elements, are now on white backgrounds.
- joo
- Posts: 5021
- Joined: Fri Jun 17, 2005 2:26 pm
- Location: London, UK
Re: CSS on my note affects the whole screen
You could use the fact that everything in a note is inside a <pre> tag, and everything outside is not, by changing your styles in the following way:
Change:
To:
Change:
Code: Select all
td { background: red }
To:
Code: Select all
pre td { background: red }
Last edited by joo on Thu Feb 13, 2014 10:24 pm, edited 1 time in total.
- Swingerzetta
- Posts: 615
- Joined: Mon Feb 11, 2013 11:21 pm
Re: CSS on my note affects the whole screen
That works great! Thanks. I didn't know about that.
So, using two items not separated by commas means the style will only be applied to td's inside pre's?
So, using two items not separated by commas means the style will only be applied to td's inside pre's?
- EchoMan
- Posts: 7768
- Joined: Fri Aug 26, 2005 1:01 pm
- Location: Stockholm, Sweden
Re: CSS on my note affects the whole screen
Yes, that is how it works. You could also add a div and an id, e.g.
... or use specific classes, eg.
Code: Select all
<style>
#mystuff ul { background: #fff; }
</style>
...
<div id="mystuff">
<ul>
<li>first item</li>
<li>Second item</li>
</ul>
</div>
... or use specific classes, eg.
Code: Select all
<style>
.my-td { background: #fff; }
</style>
...
<td class="my-td">whatever</td>
...
Who is online
Users browsing this forum: No registered users and 1 guest