473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

class=""

JD
Hi all

Is it OK to have empty class attribute values, such as

<href="url" class="">link</a> ?
Dec 15 '05 #1
10 5930
JD <us**@example.net> wrote:
Is it OK to have empty class attribute values, such as

<href="url" class="">link</a> ?


Why?

--
Spartanicus
Dec 15 '05 #2
JD
Spartanicus wrote:
JD <us**@example.net> wrote:

Is it OK to have empty class attribute values, such as

<href="url" class="">link</a> ?

Why?


I have an ASP function that draws a links menu for a dozen pages. The
function determines which page is calling the function and assigns a CSS
class to that page's link to make it bold. For this to work, the
function dims a bunch of variables and assigns empty strings to each,
then does a conditional statement to assign the "selected" CSS class to
the calling page's link.

So the user's browser ends up with:

<li><a href="url" class="">link</a></li>
<li><a href="url" class="">link</a></li>
<li><a href="url" class="selected">link</a></li>
<li><a href="url" class="">link</a></li>

The page is not mine and the CSS is too messy to start changing, but
still I'm wondering if this is OK or whether I should re-code the function?
Dec 15 '05 #3
JD <us**@example.net> wrote:
Is it OK to have empty class attribute values, such as

<href="url" class="">link</a> ?


Why?


I have an ASP function that draws a links menu for a dozen pages.


Ask in an ASP group how to change it so that it doesn't inject pointless
class attributes.

--
Spartanicus
Dec 15 '05 #4
JD
Spartanicus wrote:
JD <us**@example.net> wrote:

Is it OK to have empty class attribute values, such as

<href="url" class="">link</a> ?

Why?


I have an ASP function that draws a links menu for a dozen pages.

Ask in an ASP group how to change it so that it doesn't inject pointless
class attributes.


It's not hard to change. The question is rather should I bother? If it's
OK to have empty class attribute values, then the function can stay as
it is.
Dec 15 '05 #5
JD <us**@example.net> wrote:
Ask in an ASP group how to change it so that it doesn't inject pointless
class attributes.


It's not hard to change. The question is rather should I bother? If it's
OK to have empty class attribute values, then the function can stay as
it is.


Will it break your page: no.
Is it proper coding: no.
Is it impossible to change: it's easy to change.
Should you bother: yes.

--
Spartanicus
Dec 15 '05 #6
Spartanicus wrote:
It's not hard to change. The question is rather should I bother? If it's
OK to have empty class attribute values, then the function can stay as
it is.


Will it break your page: no.
Is it proper coding: no.
Is it impossible to change: it's easy to change.
Should you bother: yes.


Why would it be improper coding ?
Dec 16 '05 #7
Pierre Goiffon <pg******@free.fr.invalid> wrote:
It's not hard to change. The question is rather should I bother? If it's
OK to have empty class attribute values, then the function can stay as
it is.


Will it break your page: no.
Is it proper coding: no.
Is it impossible to change: it's easy to change.
Should you bother: yes.


Why would it be improper coding ?


Markup should be minimal, no more than what's needed. A single
occurrence class="" won't make a noticeable difference, but I've seen
far to many pages generated by automated functions that spit out huge
amounts of redundant markup. The fact that the OP is using ASP makes the
latter all the more likely.

--
Spartanicus
Dec 16 '05 #8
Gazing into my crystal ball I observed JD <us**@example.net> writing in
news:40*************@individual.net:
Spartanicus wrote:
JD <us**@example.net> wrote:

Is it OK to have empty class attribute values, such as

<href="url" class="">link</a> ?

Why?


I have an ASP function that draws a links menu for a dozen pages. The
function determines which page is calling the function and assigns a
CSS class to that page's link to make it bold. For this to work, the
function dims a bunch of variables and assigns empty strings to each,
then does a conditional statement to assign the "selected" CSS class to
the calling page's link.

So the user's browser ends up with:

<li><a href="url" class="">link</a></li>
<li><a href="url" class="">link</a></li>
<li><a href="url" class="selected">link</a></li> <li><a href="url"
class="">link</a></li>

The page is not mine and the CSS is too messy to start changing, but
still I'm wondering if this is OK or whether I should re-code the
function?


HTML:

<ul id="navlist">
<li><%=navlist("page.asp","Page Name")%></li>
</ul>

ASP:
<% function navlist(link,document)

if instr(link,"?") then
newlink = left(link,instr(link,"?")-1)
theending = mid(link,instr(link,"?"))
else
newlink = link
end if

if instr(request.servervariables("script_name"),newli nk) > 0 then
navlist = "<span>" & document & "</span>"
else
navlist = "<a href=" & chr(034)
if instr(link,"?") > 0 then
navlist = navlist & newlink & theending
else
navlist = navlist & link
end if
navlist = navlist & chr(034) & ">" & document & "</a>"
end if

end function
%>
CSS (change to suit):
#navlist li span {background-color:blue; color:white}
#navlist li a {background-color:white; color:blue}
--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Dec 17 '05 #9
Spartanicus wrote:
Will it break your page: no.
Is it proper coding: no.
Is it impossible to change: it's easy to change.
Should you bother: yes.


Why would it be improper coding ?


Markup should be minimal, no more than what's needed. A single
occurrence class="" won't make a noticeable difference, but I've seen
far to many pages generated by automated functions that spit out huge
amounts of redundant markup. The fact that the OP is using ASP makes the
latter all the more likely.


Actually my question was is it valid (in terms of (x)html validity) to
have an empty class attribute in an element ?
Dec 19 '05 #10
Pierre Goiffon <pg******@free.fr.invalid> wrote:
Actually my question was is it valid (in terms of (x)html validity) to
have an empty class attribute in an element ?


It's valid, but that should not be used as an excuse.

--
Spartanicus
Dec 19 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Peter King | last post by:
if you assign multiple classes in order to keep your classes generic e.g ..classA { position.absolute; left:5 top:5 height:200 width:800 } ..classB { background-color: red} ..classC {...
6
by: dpr | last post by:
I have come accross a piece of C++ code with the construct: MyClass *c = new class MyClass(); Is there a difference between this and: MyClass *c = new MyClass(); ?
3
by: janek | last post by:
I have a question: what differences are between: namespace Mary { int r = 5 ; char m ;
6
by: XiongBin | last post by:
anybody who tell me: what is the difference between "struct" and "class"? :-)
2
by: Leicester B. Ford Jr. | last post by:
I want to be able to register a class that a factory can build for me at a later time. How can I pass the class's type to a method? public class MyClass{ static public void Register(Type...
9
by: Kobe | last post by:
Is there any difference in: template <class T> vs. template <typename T> ?
1
by: BobPaul | last post by:
I'm following code out of a howto book and this is really bugging me. This header file was created by VStudio 6.0 when I did a "Right Click: Add Member Function" CLine is a class I wrote (per the...
2
by: Angus | last post by:
I am trying to change the selection in Javascript - but this HTML element is not a standard option control. On the web page it looks like a dropdown list - and you click on the right hand down...
3
by: Matt | last post by:
Hi everyone, can someone point out the difference between defining a class with the public access modifier and just leaving it as it is (default in vs.net "class") I think that the default...
7
by: BobBlock | last post by:
I have a box defined like this: <div id="shadow-container1"> <div class="shadow1"> <div class="shadow2"> <div class="shadow3"> <div class="container"> the innermost "container" is where...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.