shortysbest Posted July 8, 2010 Share Posted July 8, 2010 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 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) Quote Link to comment https://forums.phpfreaks.com/topic/207115-around-divs-cause-them-to-turn-blue-sometimes/ Share on other sites More sharing options...
freelance84 Posted July 8, 2010 Share Posted July 8, 2010 I think this may be in the wrong place, sounds like a CSS thing. What's the CSS your using? Also, if you break up that great big long line to make it easier to read Quote Link to comment https://forums.phpfreaks.com/topic/207115-around-divs-cause-them-to-turn-blue-sometimes/#findComment-1082932 Share on other sites More sharing options...
shortysbest Posted July 8, 2010 Author Share Posted July 8, 2010 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; } Quote Link to comment https://forums.phpfreaks.com/topic/207115-around-divs-cause-them-to-turn-blue-sometimes/#findComment-1082934 Share on other sites More sharing options...
haku Posted July 8, 2010 Share Posted July 8, 2010 <a> tags wrapped around <div> tags is invalid code. When your code is invalid, all bets are off. Quote Link to comment https://forums.phpfreaks.com/topic/207115-around-divs-cause-them-to-turn-blue-sometimes/#findComment-1082972 Share on other sites More sharing options...
shortysbest Posted July 8, 2010 Author Share Posted July 8, 2010 yeah but kind of need it like that for the entire div to be a link, I don't know of another way of doing this so. don't know. Quote Link to comment https://forums.phpfreaks.com/topic/207115-around-divs-cause-them-to-turn-blue-sometimes/#findComment-1082974 Share on other sites More sharing options...
sickness01 Posted July 8, 2010 Share Posted July 8, 2010 You could always try this code, <div onclick="location.href='http://www.example.com';" style="cursor:pointer;"></div> Quote Link to comment https://forums.phpfreaks.com/topic/207115-around-divs-cause-them-to-turn-blue-sometimes/#findComment-1083021 Share on other sites More sharing options...
jd307 Posted July 9, 2010 Share Posted July 9, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/207115-around-divs-cause-them-to-turn-blue-sometimes/#findComment-1083317 Share on other sites More sharing options...
shortysbest Posted July 9, 2010 Author Share Posted July 9, 2010 Thank you, the error looks like this (they are not suppose to be purple) as in visited color (the green background just indicates it's unread so pay no attention) [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/207115-around-divs-cause-them-to-turn-blue-sometimes/#findComment-1083322 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.