Autor Zpráva
gepir
Profil
Ahojte vcera jsem resil problem s barvami v tabulce, ktera je generovana z databaze v PHP. Muj problem spociva v tom, ze v jednom sloupci v databazi urcuje unikatni barvu pro nektere radky v tabulce. Nejak se to vcera nevyresilo, moderator navrhl abych zalozil topic zde v CSS s tim ze mi tady mozna poradite. Nize je odkaz na topic kde se to vcera resilo -Zde

tady je vysledny KOD v HTML - z urcitych duvodu nemuzu dat cely bohuzel.
<!-- start content -->
<div id="content">
	<h1 class="access">Start of main content</h1>

	<!-- start content head -->
	<div id="content-head">
	<p id="date-stamp">
        Thu Jul 09, 2009 08:03:58</p>
	<div class="hrule-dots">&nbsp;</div>
	<p id="breadcrumbs"><a href="javascript://">Article index</a> &gt;
	<a href="javascript://">Selling points index</a> &gt; </p>

</div><div>
	<p id="breadcrumbs"><a href="">a</a> &gt; </p>
	</div>
	<!-- stop content head -->

	<!-- start main content -->
	<div id="content-main">
		<h1>TLM Portal</h1>

		<p class="lead-in">
Version of portal is Beta 1.1!!!  Next step is make new function. <br></p>

         
<div class="basic-table">
    <table class="basic-table" cellspacing="1" cellpadding="0" width="100%">
        <caption>Hardware </caption>
<tr class="green-med-dark">
<th style="white-space:nowrap">Registered owner</th>
<th style="white-space:nowrap">Hostname</th>

<th style="white-space:nowrap">SW Manufacturer</th>
<th style="white-space:nowrap">SW Name</th>
<th style="white-space:nowrap">SW Version</th>
<th style="white-space:nowrap">SW Type</th>
<th style="white-space:nowrap">SW Comment</th>

</tr>

 
<tr class="gray" style="color:#ff0000">
<td class="date"></td><td class="date">L3AEF8H</td><td class="date">Player</td><td class="date">1.0.*</td><td class="date">81</td><td class="date">Not allowed to use, high danger,</td><td class="date">#ff0000</td></tr>

      
     
<tr class="gray" style="color:#dcdcdc">
<td class="date"></td><td class="date">L3AEF8H</td><td class="date">IDC - Microsoft Office 2003 Standard Edition</td><td class="date">11.0.*</td><td class="date">41</td><td class="date">Bought license, also from ISSI</td><td class="date">#dcdcdc</td></tr>
      
     
<tr class="gray" style="color:#dcdcdc">
<td class="date"></td><td class="date">L3AEF8H</td><td class="date">IDC - Symantec Antivirus</td><td class="date">104.0.*</td><td class="date">41</td><td class="date">Bought license, also from ISSI</td><td class="date">#dcdcdc</td></tr>

      
     
<tr class="gray" style="color:#dcdcdc">
<td class="date"></td><td class="date">L3AEF8H</td><td class="date">MICROSOFT FILE FORMAT CONVERTER</td><td class="date">12.0.*</td><td class="date">41</td><td class="date">Bought license, also from ISSI</td><td class="date">#dcdcdc</td></tr>
      
     
<tr class="gray" style="color:#dcdcdc">
<td class="date"></td><td class="date">L3AEF8H</td><td class="date">MICROSOFT QUERY</td><td class="date">11.0.*</td><td class="date">41</td><td class="date">Bought license, also from ISSI</td><td class="date">#dcdcdc</td></tr>

      
     
<tr class="gray" style="color:#dcdcdc">
<td class="date"></td><td class="date">L3AEF8H</td><td class="date">Microsoft Office Standard Edition 2003</td><td class="date">11.0.*</td><td class="date">41</td><td class="date">Bought license, also from ISSI</td><td class="date">#dcdcdc</td></tr>
      
     
<tr class="gray" style="color:#dcdcdc">
<td class="date"></td><td class="date">L3AEF8H</td><td class="date">Microsoft Visual Studio .NET</td><td class="date">7.10.*</td><td class="date">41</td><td class="date">Bought license, also from ISSI</td><td class="date">#dcdcdc</td></tr>

      
     
<tr class="gray" style="color:#dcdcdc">
<td class="date"></td><td class="date">L3AEF8H</td><td class="date">Visual C# Command Line Compiler</td><td class="date">7.0.*</td><td class="date">41</td><td class="date">Bought license, also from ISSI</td><td class="date">#dcdcdc</td></tr>


Ta barva co je v databazi se tady ukaze ale neobarvy to radky.
Plaváček
Profil
gepir

Tohle je nám k ničemu, když nevidíme CSS.

Co deklaruješ ve třídě tr class="gray" ? Respektive co má ta třída dělat? Podbarvit řádek šedou?
gepir
Profil
Tady je to CSS

@charset "utf-8";


table {border:0; font-size:1em;}

table caption,
table th,
table tr,
table td,
table tr th,
table tr td {font-size:1em;}

table caption {font-weight:bold; text-align:left;}
table th {text-align:left; font-weight:bold;}
table th, table td  {vertical-align:top;}

table tr.odd,
table tr.white 	{background:#fff;}

table tr.even,
table tr.gray 	{background:#ddd;}

.basic-table {}
.basic-table td {padding:.3em 1em;}
.basic-table th {padding:.3em 1em; text-align:left;}

table tr.blue-dark th		{background:#05a; color:#fff;}
table tr.blue-med-light th	{background:#9be;}
table tr.blue-light th		{background:#cef;}

table tr.black th		{background:#000; color:#fff;}
table tr.gray-med th		{background:#aaa;}
table tr.gray-med-light th	{background:#ccc;}
table tr.gray-light th		{background:#ddd;}
table tr.gray-lightest th	{background:#eee;}

table tr.green-med-light th	{background:#bd6;}
table tr.green-light th		{background:#dfb;}

table tr.yellow-med th		{background:#fe2;}
table tr.yellow-light th	{background:#ffa;}

table tr.red-dark th		{background:#a00; color:#fff;}

table tr.pink-med th		{background:#f76;}
table tr.pink-light th		{background:#fcc;}

table tr.violet-med-light th	{background:#b7b;}
table tr.violet-light th	{background:#ede;}


td.date	{white-space:nowrap;}
td.number	{text-align:right;}
td.center	{text-align:center;}
.up		{color:#7a3; font-weight:bold;}
.down		{color:#a00; font-weight:bold;}

.table-wrap {width:100%;}

/* Deprecated classes, the classes below should not be used due to contrast issues. */
table tr.dark th {color:#fff;}
table tr.blue-med-dark th	{background:#47b; color:#fff;}
table tr.gray-med-dark th	{background:#999; color:#fff;}
table tr.green-dark th		{background:#7a3; color:#fff;}
table tr.green-med-dark th	{background:#9c3; color:#fff;}
table tr.orange-dark th		{background:#c60; color:#fff;}
table tr.violet-dark th		{background:#936; color:#fff;}
table tr.violet-med-dark th	{background:#969; color:#fff;}
table tr.gray-dark th		{background:#666; color:#fff;}
Plaváček
Profil
gepir

Řekl bych, že chybu máš v PHP, protože všechny řádky, které generuješ, mají class="gray". Dle stylopisu by ale některé řádky měly mít class="white", ne?

V CSS žádnou chybu nevidím.
gepir
Profil
Jsem si to myslel. ze chyba je v tom PHP :-(
Kajman_
Profil *
Ale vždyť v tom html kódu je u prvního řádku barva textu nastavená jinak, dle db - takže v php si snad jen opravte color na background-color, pokud toužíte měnit barvu pozadí a ne textu. Pokud se to nebarví, tak poslané css asi nejsou jediné styly, které výsledek ovlivňují. Pošlete odkaz na celou stránku!
gepir
Profil
ty stranky nejsou na internetu je to Intranet takze se na to neda podivat, je pravda ze tam jsou dalsi css, vyresil jsem to tim ze jsem tam dal misto barvy radku jen ikonku, byl to boj s nekterymi lidmi ale je to vpohode. Zkousel jsem odstranit ty css a pak to spustit a to funguje obarvi to tak jak jsem chtel. Ale podle urcitych standartu co tady jsou tak je nesmim prepisovat a vlastne to ani nejde.
Kajman_
Profil *
Ještě můžete dát tu barvu do každého td, ale to není moc systémové řešení.

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0