473,401 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Can I modify body, table, and p attributes with a style?

Hello all,

Me again :>) Can I modify certain attributes in a style within a
stylesheet? Example: I have a style sheet that looks like this:

body { background-color: black; font-family: Arial; font-size: 13pt;
color: white; margin: 5 5 5 5 }

p { font-family: Arial; font-size: 13pt; color: white; line-height:
125%; margin-top: 5px; margin-bottom: 5px}

table {width: 100%; align:top; border-collapse: collapse; padding: 5px}

tr { vertical-align: top; text-align: left}

td { font-family: arial; font-size: 13pt; color: white; line-height:
125%; padding: 7px }

#tdfaq { font-family: arial; font-size: 13pt; font-weight: bold; color:
black; line-height: 125%; padding: 7px }
Now, say I want to create a style within the sheet but I want the
tables and font to look different. Could I do that with a command
similar to this:?

..newstyle {body: XXXX; table: XXXX; td:XXXX; p:font-color=XXXX}

I'm sure that this command is invalid, but I think y'all get the idea.
The thing is, I want to create ONE master style sheet for the entire
site, but some pages will have different fonts or font colors and the
tales will look different as well.

Also one problem I'm having is that if I have a <P> tag within a <TD>
tag, the font color defaults to whatever the <P> tag is. In the example
above, you can see that I have a <TD> called "#tdfaq". You can see that
the font color within that <TD> is black. But when a <P> tag is used
within that, the font comes out white. I'd like to avoid this by doing
what I explained above: creating a style (within a stylesheet) that has
different <P> or <TD> tags.

Does this make sense or did I confuse everyone? Thanks for any answers.

Viken K.

Jul 21 '05 #1
3 5236
Els
Viken Karaguesian wrote:
Me again :>) Can I modify certain attributes in a style within a
stylesheet? Example: I have a style sheet that looks like this:

body { background-color: black; font-family: Arial; font-size: 13pt;
color: white; margin: 5 5 5 5 }
Don't use pt for font-sizes on screen. Use % instead, 100% being the
medium size on the visitor's browser.
Now, say I want to create a style within the sheet but I want the
tables and font to look different. Could I do that with a command
similar to this:?

.newstyle {body: XXXX; table: XXXX; td:XXXX; p:font-color=XXXX}

I'm sure that this command is invalid, but I think y'all get the idea.
The thing is, I want to create ONE master style sheet for the entire
site, but some pages will have different fonts or font colors and the
tales will look different as well.
No problem, if the page is entirely different, make a separate
stylesheet. If only a few things are different, give those pages
different classes where they are different, and use those classes in
the stylesheet.
Also one problem I'm having is that if I have a <P> tag within a <TD>
tag, the font color defaults to whatever the <P> tag is.
Of course :-)
In the example
above, you can see that I have a <TD> called "#tdfaq". You can see that
the font color within that <TD> is black. But when a <P> tag is used
within that, the font comes out white. I'd like to avoid this by doing
what I explained above: creating a style (within a stylesheet) that has
different <P> or <TD> tags.
You could just have it like this in your stylesheet:

p{color:white;background:black;}
td{color:black;background:white;}
td p{color:black;background:white;}

"td p" means any <p> element which is inside a <td> element.
Does this make sense or did I confuse everyone? Thanks for any answers.


I'm not confused ;-)

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 21 '05 #2
Viken Karaguesian wrote:
Hello all,

Me again :>) Can I modify certain attributes in a style within a
stylesheet? Example: I have a style sheet that looks like this:

body { background-color: black; font-family: Arial; font-size: 13pt;
color: white; margin: 5 5 5 5 }
5 what? pixels? ems? light-years? With HTML pixels are assumed; with
CSS you must specify the units unless the value is 0.
table {width: 100%; align:top; border-collapse: collapse; padding: 5px}
No such property as align in CSS, Perhaps you mean vertical-align. But
you want to set this property for td, not table.
td { font-family: arial; font-size: 13pt; color: white; line-height:
125%; padding: 7px }
You should specify alternatives for the font in case Arial is not
installed. E.g. font-family:Arial, Helvetica, sans-serif;
#tdfaq { font-family: arial; font-size: 13pt; font-weight: bold; color:
black; line-height: 125%; padding: 7px }
Ditto
Now, say I want to create a style within the sheet but I want the
tables and font to look different. Could I do that with a command
similar to this:?

.newstyle {body: XXXX; table: XXXX; td:XXXX; p:font-color=XXXX}
No
I'm sure that this command is invalid, but I think y'all get the idea.
The thing is, I want to create ONE master style sheet for the entire
site, but some pages will have different fonts or font colors and the
tales will look different as well.
This is easy, but you have to learn CSS. I suggest you buy a good
reference book.
Also one problem I'm having is that if I have a <P> tag within a <TD>
tag, the font color defaults to whatever the <P> tag is. In the example
above, you can see that I have a <TD> called "#tdfaq". You can see that
the font color within that <TD> is black. But when a <P> tag is used
within that, the font comes out white.
Which is what is supposed to happen.
I'd like to avoid this by doing
what I explained above: creating a style (within a stylesheet) that has
different <P> or <TD> tags.


Again, get a good CSS reference book. See
http://www.upsdell.com/BrowserNews/res_css.htm

Jul 21 '05 #3
Viken Karaguesian wrote:
Now, say I want to create a style within the sheet but I want the
tables and font to look different. Could I do that with a command
similar to this:?

.newstyle {body: XXXX; table: XXXX; td:XXXX; p:font-color=XXXX}
I'm really not sure what you are trying to achieve here, but see:

http://www.w3.org/TR/CSS2/selector.html

I think you might want a descendant selector.
Also one problem I'm having is that if I have a <P> tag within a <TD>


While it is possible to have tabular data consisting of paragraphs, it isn't
very common. You should check to make sure the semantics of your markup are
appropriate.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dave | last post by:
Hi Is specifying attributes (basic font size, colour etc) with a "body" tag in a style sheet as good as putting those things in a basic "p" tag for the sheet? If the answer is that using "p"...
11
by: Konrad Den Ende | last post by:
I have a function returning a string but the problem is that the color of it is blue which suits me well for some pages but not for others. Is it possible to "feel" what the color of the background...
9
by: Carlis | last post by:
I want to make a program that, when you have the mouse on a word, that word is bold... and when you don't have the mouse on that word, the word is not bold. Excuse me for my poor English :-( But...
0
by: Pocholo | last post by:
I'm working with AxWebBrowser and i try to change the entire page, but i don't find any way to do it also i try to change by parts: First the body: htmlDoc1.body.innerHTML="...."; and this...
12
by: Terry Moon | last post by:
Hi I was using <BODY leftmargin=20 > which worked ok. but then I changed it to <BODY style="margin-left:20px;" and this works fine as well. In order to try and formalise things I decided to...
5
by: Progman | last post by:
<body id="body" style="background-image:url(../../Pictures/System/CountryMosaic.JPG)"> how do i get/set body.style from asp.net?
3
by: PYG | last post by:
Hi everybody I have a simple question : If i use this code : <body style="font-size:24px;color:blue;"> Text in body <table> <tr><td> Text in table
6
by: _Who | last post by:
I use the code below to change to a style sheet that has: body { ....
4
by: AAaron123 | last post by:
<body runat="server" id="MainBody"> <form id="form1" runat="server" style="background-color:green; width: 100%; height: 100%"> <br /> Table1" runat="server" Style="background-color:Yellow;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.