Jump to content

<a href=""></a> around divs cause them to turn blue sometimes


shortysbest

Recommended Posts

so i have this array that prints out a row of data, and sometimes 1 or a couple of them turn to the visited, or unvisited color link rather than staying how i have them styled. When i refresh the page they fix, or others do the same thing. It looks very bad :| can't have that, so i am wondering whyy this is doing this? i'v had this problem for awhile now, but need it fixed already :D

 

print '<a class="ulclear" href="index.php?node=inbox&id='.$row2['id'].'&fid='.$row2['from'].'"><div '.$unread.'><div class="inbox-message-
thumb"></div><div class="inbox-message-header"><div class="inbox-message-from">('.$sel['fname'].') </div> '.$row2['header'].'<div class="inbox-message-date">
'.date('D, M j, Y \\a\t g:ma', strtotime($row2['date'])).'</div></div><div class="inbox-message-body">'.substr($input,
0,$cut).$dots.'</div></div></a>';	

 

that would be my code for one of the sections that does it.

 

(only notice this on my server, not localhost)

well the entire css for it would be:

 

.inbox-message-container {
display: block;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #E5E5E5;
padding: 5px;
height: 50px;
overflow: hidden;
border-right-width: 1px;
border-right-style: solid;
border-right-color: #E5E5E5;
text-decoration: none;
}
.inbox-message-container:hover {
text-decoration: none;
background-color: #FFF8EC;
}
.inbox-message-thumb {
background-color: #F4F4F4;
float: left;
height: 50px;
width: 50px;
overflow: hidden;
margin-right: 5px;
}
.inbox-message-from {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
color: #333;
display: inline;
}


.inbox-message-header {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #2d4965;
height: 15px;
overflow: hidden;
text-decoration: none;
display: inline;
}
.inbox-message-date {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
color: #666;
text-decoration: none;
float: right;
display: inline;
}

.inbox-message-body {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #818181;
overflow: hidden;
font-weight: normal;
text-decoration: none;
height: 30px;
padding-top: 5px;
}

Try styling the anchor <a... /> tags for the visited colours, etc. to be whatever you want them to be.  It sounds like that you are getting this because the web browser thinks you have already visited the page the link goes to.  Add this styling in to keep the colour you want and it *should* go away.

 

Also, if you are getting the div changing colour... is it the entire div's background that turns blue?  Or is it just the border?  Images have a tendancy to turn the border blue or red (cant remember off the top of my head exactly which colour, but either way).  All you need to do is again style the anchor tags to NOT do this, or the image (div in your case) to NOT change colour.

 

Like already stated:  you shouldn't really be putting anchor tags AROUND a DIV.  These kinds of tags must open and close inside or outside of a container, never around them to validate.  From what I think you are trying to do (create a DIV that contains information about a new message a user has recieved, then the user just clicks the DIV to open their inbox and display the message?) then your best method probably would be some sort of JavaScripting (if you WANT to make your code valid... which you should really).  The onclick idea that sickness01 has posted is a good option.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.