School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 306,971 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,848 people online right now. Registration is fast and FREE... Join Now!




HREF for links

 

HREF for links

Zel2008

6 Nov, 2009 - 07:26 AM
Post #1

D.I.C Head
**

Joined: 6 Jan, 2009
Posts: 173


My Contributions
Hi everybody,

I just have a quick question about HREF syntax.

Why does this work:
CODE

        <LINK
            REL=StyleSheet
            TYPE="text/css"
            HREF="http://serverAddress/StyleSheet.css"
        >


but not this:
CODE

        <LINK
            REL=StyleSheet
            TYPE="text/css"
            HREF="http://serverAddress/LongFolderName/
                       StyleSheet.css"
        >


????

Are there any correct ways to make an HREF attribute span multiple lines, for readability purposes?

Thanks,
Zel2008

User is offlineProfile CardPM
+Quote Post


Nykc

RE: HREF For Links

6 Nov, 2009 - 07:51 AM
Post #2

This script is cheap!
Group Icon

Joined: 14 Sep, 2007
Posts: 6,561



Thanked: 44 times
Dream Kudos: 375
My Contributions
whitespace?

there really isnt much need to bury a stylesheet so deep into a web directory is there? I mean http://serveraddress/includes/style.css

you should also refrain from camel-casing your names as it leads to confusion in web development. This isn't Java. keep it all lowercase and use "_" underscores for spaces.
User is offlineProfile CardPM
+Quote Post

Zel2008

RE: HREF For Links

6 Nov, 2009 - 08:31 AM
Post #3

D.I.C Head
**

Joined: 6 Jan, 2009
Posts: 173


My Contributions
Thanks Nykc,
I tried whitespace, that isn't working. Do you have any other ideas?

The example you gave:
Http://Serveraddress/Includes/Style.Css

Is almost exactly how I have my style sheet, it just isn't in "Includes", it's in a different folder name that's a bit longer.

Since I already have almost 120 files, it's a little late to change "camel casing", as you put it, but I'll remember that for next time.

Thanks,
Zel2008
User is offlineProfile CardPM
+Quote Post

Nykc

RE: HREF For Links

6 Nov, 2009 - 08:38 AM
Post #4

This script is cheap!
Group Icon

Joined: 14 Sep, 2007
Posts: 6,561



Thanked: 44 times
Dream Kudos: 375
My Contributions
you can't use white-spacing in the names for readability.

Here are some examples that should help you out, enclose your values in " " and you should be ok.

http://www.w3.org/TR/REC-html40/struct/links.html#h-12.3

User is offlineProfile CardPM
+Quote Post

Zel2008

RE: HREF For Links

6 Nov, 2009 - 09:01 AM
Post #5

D.I.C Head
**

Joined: 6 Jan, 2009
Posts: 173


My Contributions
Thanks Nykc,
I appreciate your help; I'll check it out.
Thanks,
Zel2008
User is offlineProfile CardPM
+Quote Post

Nykc

RE: HREF For Links

6 Nov, 2009 - 09:08 AM
Post #6

This script is cheap!
Group Icon

Joined: 14 Sep, 2007
Posts: 6,561



Thanked: 44 times
Dream Kudos: 375
My Contributions
You are welcome, I hope it helps.
User is offlineProfile CardPM
+Quote Post

Gorian

RE: HREF For Links

6 Nov, 2009 - 01:08 PM
Post #7

ninja DIC
Group Icon

Joined: 28 Jun, 2008
Posts: 711



Thanked: 8 times
Dream Kudos: 125
My Contributions
While that is possible cleaner, when hand coding a longer HTML Document, it might be easier to just do it as such:

HTML

<LINK REL="StyleSheet" TYPE="text/css" HREF="http://serverAddress/StyleSheet.css" >


Just my opinion, it is still pretty readable, especially if you make sure to close everything in "
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 04:51AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month