I would like to vizualize different class variables in the same table in different colors. How to describe this in stylesheet?
For example, the stylesheet which i use now colors both classes in red. I want that day 30 would be blue and day 1 would be red. - <style>
-
table,th,td { border:1px solid black; }
-
table .mainmonth { color: #000080; }
-
table .nextmonth { color: #FF0000; }
-
.error { color: red; }
-
-
</style>
- <table>
-
<tr>
-
<td height=17 align="center" >
-
<span class="date" class="mainmonth" >
-
<div class="day">30</div>
-
<div class="price"><input type="text" name="ad2014-12-29price" size="2" value="" ></div>
-
<div class="status"><input type="checkbox" name="ad2014-12-29status" ></div> </span>
-
</td>
-
</tr>
-
<tr> <td height=17 align="center" >
-
<span class="date" class="nextmonth" >
-
<div class="day">1</div>
-
<div class="price"><input type="text" name="ad2014-12-29price" size="2" value="" ></div>
-
<div class="status"><input type="checkbox" name="ad2014-12-29status" ></div>
-
</span>
-
</td>
-
</tr>
-
</table>
it did not work because you put two class in your element, if you want to use two class or more in one element you can do it this way. the right way to call a class. - <span class="nextmonth date" >
the wrong way. - <span class="nextmonth" class="date" >
15 1678
Give day 1 a different class from day 30.
add this to your css, -
table tr td{background:#00F;}
-
table tr:nth-child(odd) td{background:#FF0000;}
-
i gave different class, but this does not work. In reality i have a table-calendar. I would like to color class "mainmonth" with blue and class "nextmonth" with red. I do not know how to use class with table in css. - table .mainmonth { color: #000080; }
-
table .nextmonth { color: #FF0000; }
This code colors everything in red.
Dear Exequiel, i need to color more days than given in the example above. Odd or even does not suit. I have assigned class to each day. I would like to color class "mainmonth" with blue and class "nextmonth" with red. I do not know how to use class with table in css. - table .mainmonth { color: #000080; }
-
table .nextmonth { color: #FF0000; }
This code colors everything in red.
In the end i did not find out how to use classes. If you know how, please write advice. As a solution it is possible to give style colors for separate td in the table. - <table>
-
<tr>
-
<td height=17 align="center" style="color:red"> <span class="date" >
-
<div class="day" >30</div>
-
<div class="price"><input type="text" name="ad2014-12-29price" size="2" value="" ></div>
-
<div class="status"><input type="checkbox" name="ad2014-12-29status" ></div>
-
</span>
-
</td></tr>
-
<tr>
-
<td height=17 align="center" style="color:blue"> <span class="date" >
-
<div class="day" >1</div>
-
<div class="price"><input type="text" name="ad2014-12-29price" size="2" value="" ></div>
-
<div class="status"><input type="checkbox" name="ad2014-12-29status" ></div>
-
</span>
-
</td></tr>
-
</table>
can you post an image for the output that you want to create? and i will code it in css for you. i cant't get what you mean, are u trying to create a callendar? , , but in css its just easy to use a class,
for example you have a class .mainmonth and .nextmonth in css, - .mainmonth{background:#red;}
-
.nextmonth{background:#blue;}
-
you can call or use that by calling each name class in your html element, -
<table class="mainmonth"></table>
-
<table class="nextmonth"></table>
-
Your example does not work for table element with class. Do not know why.
Tutorial also does not show example how to describe class within table.
It seems that instead of defining a class, i have to define style property inside the table element.
you did not not get the point of the tutorial that i send to you, , I know you don't know how to use class for an element, , That's what i observed. well you need to research more about css/css3 on how to use it, where did you save your css file by the way?
Please see the question description. I use <style> tag, not style file. The class definition simple do not work inside the table. - <style>
-
table,th,td { border:1px solid black; }
-
table .mainmonth { color: #000080; }
-
table .nextmonth { color: #FF0000; }
-
</style>
I ask for syntax, how to describe table class in <style> ? Class applies to <div> or <span> inside <td>. - <table>
-
<tr>
-
<td height=17 align="center" >
-
<span class="date" class="mainmonth" >
-
<div class="day">30</div>
-
<div class="price"><input type="text" name="ad2014-12-29price" size="2" value="" ></div>
-
<div class="status"><input type="checkbox" name="ad2014-12-29status" ></div> </span>
-
</td>
-
</tr>
-
<tr> <td height=17 align="center" >
-
<span class="date" class="nextmonth" >
-
<div class="day">1</div>
-
<div class="price"><input type="text" name="ad2014-12-29price" size="2" value="" ></div>
-
<div class="status"><input type="checkbox" name="ad2014-12-29status" ></div>
-
</span>
-
</td>
-
</tr>
-
</table>
The first solution was to define style in the td element like - <td height=17 align="center" style="color:blue">.
The second solution is to use class in td element. When i use class for inner td elements "div" or "span", it is not working. But if i define class in td, when table cells are colored. - <style> .mainmonth { color: #000080; } </style>
-
<td height=17 align="center" class="mainmonth">
it did not work because you put two class in your element, if you want to use two class or more in one element you can do it this way. the right way to call a class. - <span class="nextmonth date" >
the wrong way. - <span class="nextmonth" class="date" >
by the wayi created some tuts on how to use css for element using class. I hope it helps, just observed the elements and the class i called, better to copy paste this code and save this as a html file and run to see for your self. -
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<html xmlns="http://www.w3.org/1999/xhtml">
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
<title>Untitled Document</title>
-
-
<style>
-
table.table{border:1px solid #000;}/*must be call by table only*/
-
table.table tr td{color:#990000;}/*for all td element inside the table and tr*/
-
table.table tr td.withborder{border:1px solid #666; color:#0000FF;}/*must be inside of table element and tr and call by td*/
-
-
div.div{background:red;}/*must be call by div only*/
-
div.div .child{border:#999; background:#000000; color:#FFFFFF;}
-
-
.universal{background:#CCC; border-radius:5px;}/*can call by any element*/
-
.someclass{border:1px solid #0CC;}/*can call by any element*/
-
.red{color:#F00;}/*can call by any element*/
-
.padding{padding:5px;}/*can call by any element*/
-
-
div{padding:5px;} /*if you put div element the style of this css div will adopt by all div div*/
-
</style>
-
-
</head>
-
-
<body>
-
<h2>Calling class to the right element</h2>
-
<table class="table">
-
<tr>
-
<td>For table only</td>
-
<td class="withborder">with class withborder</td>
-
<td>For table only</td>
-
</tr>
-
</table>
-
<br>
-
<div class="div">For div only</div>
-
<br>
-
<div class="div">
-
div with child element.
-
<div class="child">i'm the child</div>
-
</div>
-
<br>
-
<div class="universal"><b>universal</b> universal class, You can call me to any element</div>
-
<br>
-
<table class="universal">
-
<tr>
-
<td>universal class called by table element.</td>
-
</tr>
-
</table>
-
<br>
-
-
<h2>wrong css call by elements.</h2>
-
-
<b>the class table call by an element div.</b>
-
<div class="table">The class <b>table</b> didnot work for this element because you declare on your css that the table class is ony for the elelemnt table. [table.table{}] if you put only in the css like this [.table] it will adopt by any elelemnts as long as you call this class, </div>
-
<br>
-
<b>the class div call by an element table.</b>
-
<table class="div">
-
<tr>
-
<td>div class for table didnot work, </td>
-
</tr>
-
</table>
-
-
<h2>How to call multiple class in one element.</h2>
-
<div class="div universal someclass">I have 3 class</div>
-
<div class="universal red padding">I have 3 class</div>
-
-
<table class="table universal someclass red padding">
-
<tr>
-
<td>the table with 5 class.</td>
-
</tr>
-
</table>
-
</body>
-
</html>
-
-
I hope it helps.
your welcome, good luck. :)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Manuel |
last post by:
I want to describe a table of a database in XML flavour and I would
like to know if there is some 'standard' schema to pick as example to
produce my .xml definition file.
PS: I'll work with PHP...
|
by: Kevin Myers |
last post by:
Hello,
I'm an experienced application developer in some languages (including
various SQL dialects), but have very little experience with MS Access or
VBA, and am having trouble figuring out how...
|
by: Steve Stover |
last post by:
I want to use the caching API in .net to store data. The data would be
stored in a data table class that has approx. 10 columns and 71 rows. What
I need to know is this: According to Microsoft's...
|
by: Brian Mitchell |
last post by:
Ok, I know this is an elementary question but I have a data grid that is
bound to a data table and I can't seem to find a way to match the selected
row in the grid with it's respective row in the...
|
by: Ron L |
last post by:
I have a data table that lists a series of items in my database. In my user
form, I want the user to be able to filter by a number of criteria (e.g.
location, contract, date modified, etc). Other...
|
by: John |
last post by:
Hi
When using Table Adapter Configuration Wizard if 'Use SQL Statements' is
selected as Command Type, the data table's name in dataset is retained and
only its data adapter's select statements...
|
by: laredotornado |
last post by:
Hi,
I have a data table on my page (buried amidst other images and
extraneous text). I would like to spawn a new window that
automatically prints the content of my data table, and only that...
|
by: Serman D. |
last post by:
Hi all,
How do I describe non-table objects, like UDF functions and
procedures, using db2's normal command line interface?
Database server = DB2/LINUX 9.1.0 Express-C running on Linux 2.6...
|
by: indona |
last post by:
hi, i have to enter data from a delimited file into sqlserver database table.
i have been able to delimit the file and read the data into a data table, now i want enter the data table contents to...
|
by: BaseballGraphs |
last post by:
Hello,
I am trying to divide one value from my data table with an associated ID by another value from my data table with a different ID for the same day that the value was added to the data table....
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
| |