LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-25-2016, 08:44 AM   #1
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,288

Rep: Reputation: 52
html validator/css questions


Having only a little knowledge on these subjects, I have found the following code on the Internet I thought I could adapt to my needs:
Code:
#example1 .hover{display:none;}
#example1 .nohower{display:block;}
#example1:hover .hover{display:block;}
#example1:hover .nohower{display:none;}
#example2:hover span:after{content:attr(data-hover);}
#example2:hover span{width:1px;margin-left: -0.5em;}
.hoverer {border:1px solid black;overflow:hidden;}
<table>
<thead>
<tr><th class="hoverer">CSS2: hiding</th><th class="hoverer">CSS3: content</th></tr>
</thead>
<tbody>
<tr><td id="example1" class="hoverer"><span class="nohower">1</span><span class="hover">50</span></td><td id="example2" class="hoverer"><span data-hover="50">1</span></td></tr>
</tbody></table>
It does exactly what it is supposed to do which is to replace value "1" with value "50" when "1" is hovered. I was hoping to adapt the code below so that the value "Klik hier vir" becomes "Klik hier vir....."

This works but the w3c validator does not like it, it gives an error:
Quote:
there is no attribute "DATA-HOVER"....... this is usually fixed by using CSS to achieve the desired effect instead
It seems the cause is a mixture of HTML4 and HTML5. I also had to make a slight change because when testing the original code, one value replaces the other but when testing my code they are concatenated (which suits me fine). I have tried various "DOCTYPE" all giving the same result.

My questions are:
1) Is it safe to ignore the error - will most browsers behave like Epiphany?
2) What code should I change with CSS to fix the problem and how?

Thank you for your help.

PS: here is my full test:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>Language Selection.</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link rel=stylesheet type="text/css" href="css.css"><style type="text/css">a:link {color: hotpink;}a:visited{color: ;}a:hover{color: black;}a:active {color: red;}td {white-space:nowrap; color: #000000;}table{margin: auto;}h3{text-align: center; color: #FFFF00;}td {white-space:nowrap; color: #000000;}table{margin: auto;}h3{text-align: center; color: #FFFF00;}#example2:hover span:after{content:attr(data-hover);}#example2:hover span{width:1px;margin-left: -0.5em;}.hoverer {border:1px solid black;overflow:hidden;}
</style></head><body>
<table>
<!--Afrikaans --><tr><td id="example2" class="hoverer" lang="af"><a href="http://127.0.0.1/languages/af/show_splash.htm"><span data-hover="...">Klik hier vir</span></a></td><td lang="af">Afrikaans</td><td></td></tr>
</table></body></html>

Last edited by rblampain; 09-25-2016 at 08:47 AM.
 
Old 09-25-2016, 09:56 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
Is there a reason you cannot choose html 5? On doing so the w3c validator shows me no errors.
 
1 members found this post helpful.
Old 09-25-2016, 10:38 AM   #3
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
In Html 4.1 transitional, maybe you could use "title" attribute instead of "data-hover"
 
2 members found this post helpful.
Old 09-26-2016, 04:36 AM   #4
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,288

Original Poster
Rep: Reputation: 52
Thank you for the answers.
Quote:
Is there a reason you cannot choose html 5?
I wrongly assumed I had to change all the coding including frames that the site uses, a recent check seems to indicate I only need to change the top headings to make it HTML5 instead of HTML4 and I will try that although it seems I cannot avoid frames which I made the subject of another thread.

Quote:
..you could use "title"
Thank you for the tip, I will use that if I find I am not unknowingly inserting any more HTML5 features in my code.

Last edited by rblampain; 09-26-2016 at 06:46 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need a CSS Validator halfpower Linux - Software 3 10-30-2022 12:10 PM
CSS - Is there a way to put several lines of HTML into one line using CSS? Chronothread Programming 12 01-05-2011 06:06 AM
w3c validator refuses to validate HTML code rblampain Debian 9 06-07-2007 06:38 PM
HTML/CSS/JS: Problem with <p> not having an absolute position with CSS. RHLinuxGUY Programming 7 03-03-2007 12:21 AM
HTML and css validator linuxmandrake Linux - Software 1 03-07-2006 10:46 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration