---
title: "Problem med CSS"
type: "forum-thread"
url: "https://www.webforum.nu/amne/html-css/138035-problem-med-css"
topic: "HTML & CSS"
topic_url: "https://www.webforum.nu/amne/html-css"
author: "wborg"
published: "2005-11-21T19:08:56.000Z"
updated: "2005-11-22T08:51:25.000Z"
replies: 4
views: 279
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/html-css/138035-problem-med-css"
---

# Problem med CSS

## #1 — wborg, 2005-11-21T19:08Z

Hej,

Har följande kod i en style tagg:

```
<style>
.blueText {
	  color: blue;
	  font-weight: bold;
          }   
.greenText {
	color:green;
	font-weight: bold;
}   
.redText {
	color:red;
	font-weight: bold;
}   
.blackText {
	color:black;
	font-weight: bold;
}   
</style>
```

sen har jag i bodyn följande kod:

```
	<td align="center">
	<% 
	strTot = objrs("TOTAL")
	if strTot < 30 then 
		response.write "<span class=""blueText"">"&strTot&"</span>"
	elseif strTot < 36 then 
		response.write "<span class=""greenText"">"&strTot&"</span>"
	elseif strTot < 40 then
		response.write "<span class=""redText"">"&strTot&"</span>"
	elseif strTot > 39 then
		response.write "<span class=""blackText"">"&strTot&"</span>"
	End if 	
	response.write vbCrLf & "</td>" & vbCrLf & "</tr>" & vbCrLf
	prevDate = currDate
	objrs.movenext
wend
if i=0 then 'empty recordset
  response.write "<tr><td colspan=""19"">Det finns inga resultat!</td></tr>"
end if
%>
</table>
```

problemet är att alla resultat som är under 30 inte blir blåa men dom andra färgerna funkar som dom ska.

Någon som kan se varför?

För enkelhetens skull bifogar jag hela koden här:

```
<%
Sub createNewTableStart(endPrevTable)
	if endPrevTable then response.write vbCrLf & "</table>" & vbCrLf & "<br />" & vbCrLf
%>

<b><%=objrs("Comp_Name") %></b>

<br>
<table border="1" style="border-collapse: collapse" bordercolor="1px solid #000000">
    <tr bgcolor="#CDD5E4" style="font-weight: bold">
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=1" target="top10">1</a></td>
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=2" target="top10">2</a></td>
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=3" target="top10">3</a></td>
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=4" target="top10">4</a></td>
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=5" target="top10">5</a></td>
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=6" target="top10">6</a></td>
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=7" target="top10">7</a></td>
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=8" target="top10">8</a></td>
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=9" target="top10">9</a></td>
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=10" target="top10">10</a></td>
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=11" target="top10">11</a></td>
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=12" target="top10">12</a></td>
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=13" target="top10">13</a></td>
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=14" target="top10">14</a></td>
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=15" target="top10">15</a></td>
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=16" target="top10">16</a></td>
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=17" target="top10">17</a></td>
        <td width="30" align="center"><a href="top10.asp?Show=Top10&Lane=18" target="top10">18</a></td>
        <td width="30" align="center">Tot</td>
    </tr>
<%
End Sub
%>
<html>
<head>
<title></title>
<style type="text/css">
td {
     font-size: 11px;
     font-family: verdana;
     color: black;
   }
a:hover  {
         text-decoration: none;
         color: black;
         }
a:visited {
          text-decoration: none;
          color: black;
.blueText {
	  color: blue;
	  font-weight: bold;
          }   
.greenText {
	color:green;
	font-weight: bold;
}   
.redText {
	color:red;
	font-weight: bold;
}   
.blackText {
	color:black;
	font-weight: bold;
}   
</style>
<link rel="stylesheet" type="text/css" href="css/table.css">
</head>
<body>
<%
dim Conn, objrs, i, prevDate, currDate, strTot
Set Conn = Server.CreateObject("ADODB.Connection") 
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db/xlr13x3sm.mdb") 
Set objrs = Conn.Execute("SELECT tbl_player.Namn, tbl_player.Efternamn, tbl_res.AMT1, tbl_res.AMT2, tbl_res.AMT3, tbl_res.AMT4, tbl_res.AMT5, tbl_res.AMT6, tbl_res.AMT7, tbl_res.AMT8, tbl_res.AMT9, tbl_res.AMT10, tbl_res.AMT11, tbl_res.AMT12, tbl_res.AMT13, tbl_res.AMT14, tbl_res.AMT15, tbl_res.AMT16, tbl_res.AMT17, tbl_res.AMT18, tbl_res.TOTAL, tbl_res.Date, tbl_res.Comp_Name FROM tbl_player INNER JOIN tbl_res ON tbl_player.PlayerId=tbl_res.PlayerId WHERE tbl_res.Surface ='Filt' ORDER BY tbl_res.Date, tbl_res.Varv")

i=0
while not objrs.BOF and not objrs.EOF
  currDate = objrs("Date")
  if IsEmpty(prevDate) then 'first iteration
	createNewTableStart(false)
  elseif prevDate <> currDate then
	createNewTableStart(true)
  end if
  i = i + 1
  If i Mod 2 = 0 Then
%>
  <tr bgcolor="#EEEEEE">
  <% Else %>
  <tr bgcolor="#FFFFFF">
  <% End If %>
	
	<td align="center"><%=objrs("AMT1")%></td>
	<td align="center"><%=objrs("AMT2")%></td>
	<td align="center"><%=objrs("AMT3")%></td>
	<td align="center"><%=objrs("AMT4")%></td>
	<td align="center"><%=objrs("AMT5")%></td>
	<td align="center"><%=objrs("AMT6")%></td>
	<td align="center"><%=objrs("AMT7")%></td>
	<td align="center"><%=objrs("AMT8")%></td>
	<td align="center"><%=objrs("AMT9")%></td>
	<td align="center"><%=objrs("AMT10")%></td>
	<td align="center"><%=objrs("AMT11")%></td>
	<td align="center"><%=objrs("AMT12")%></td>
	<td align="center"><%=objrs("AMT13")%></td>
	<td align="center"><%=objrs("AMT14")%></td>
	<td align="center"><%=objrs("AMT15")%></td>
	<td align="center"><%=objrs("AMT16")%></td>
	<td align="center"><%=objrs("AMT17")%></td>
	<td align="center"><%=objrs("AMT18")%></td>
	<td align="center">
	<% 
	strTot = objrs("TOTAL")
	if strTot < 30 then 
		response.write "<span class=""blueText"">"&strTot&"</span>"
	elseif strTot < 36 then 
		response.write "<span class=""greenText"">"&strTot&"</span>"
	elseif strTot < 40 then
		response.write "<span class=""redText"">"&strTot&"</span>"
	elseif strTot > 39 then
		response.write "<span class=""blackText"">"&strTot&"</span>"
	End if 	
	response.write vbCrLf & "</td>" & vbCrLf & "</tr>" & vbCrLf
	prevDate = currDate
	objrs.movenext
wend
if i=0 then 'empty recordset
  response.write "<tr><td colspan=""19"">Det finns inga resultat!</td></tr>"
end if
%>
</table>
<%
'close and kill recordset/connection objects
objrs.close
set objrs = nothing
Conn.close
set Conn = nothing
%>

</body>
</html>
```

Tacksam för alla svar jag kan få i denna fråga
/S

Permalänk: https://www.webforum.nu/p/138035

## #2 — Travoni, 2005-11-21T20:04Z

Posta inte ASP-kod i detta forum.
Det som är intressant är det som ligger i källan.

Permalänk: https://www.webforum.nu/p/1713657

## #3 — Insider, 2005-11-21T20:21Z

```
a:visited {
          text-decoration: none;
          color: black;
          [B]}[/B] [blue]<-----[/blue]
.blueText {
	  color: blue;
	  font-weight: bold;
          }
```

Du hade missat en måsvinge.

Permalänk: https://www.webforum.nu/p/1713666

## #4 — wborg, 2005-11-21T21:23Z

Tack Insider

Permalänk: https://www.webforum.nu/p/1713685

## #5 — Troxy, 2005-11-22T08:51Z

**Ett hett tips:** Döp inte dina classer efter dess utseende utan efter dess funktion. En vacker dag kanske du vill att *.blueText* ska vara grön, vilket blir ganska ologiskt och förvirrande.

Permalänk: https://www.webforum.nu/p/1713791

---

Tråden på webben: https://www.webforum.nu/amne/html-css/138035-problem-med-css
