Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
Like Tree1Likes

Thread: <style> works but external.css doesn't?

  1. #1
    Member
    Join Date
    Mar 2012
    Posts
    50
    Member #
    31189

    <style> works but external.css doesn't?

    Question: the following <style> works for me:

    <style type="text/css">
    .slide1 a:link { text-decoration: none; color: black;}
    .slide1 a:visited {text-decoration: none}
    .slide1 a:active {text-decoration: none}
    .slide1 a:hover {text-decoration: underline; color: black;}
    </style>

    But when I use it externally as slide1.css
    .slide1 {
    a:link { text-decoration: none; color: black;}
    a:visited {text-decoration: none}
    a:active {text-decoration: none}
    a:hover {text-decoration: underline; color: black;}
    }

    and then link with:
    <link rel="stylesheet" type="text/css" href="css/slide1.css" />

    I get just the generic (blue and static) hyperlink.

    What gives? Any thoughts?
    (I'd like my <style> parts to be external files for organizational purposes...)

  2.  

  3. #2
    WDF Staff AlphaMare's Avatar
    Join Date
    Oct 2009
    Location
    Montreal, Canada
    Posts
    4,570
    Member #
    20277
    Liked
    878 times
    Your code is wrong. Try this:

    .slide1 a:link { text-decoration: none; color: black;}
    .slide1 a:visited {text-decoration: none}
    .slide1 a:active {text-decoration: none}
    .slide1 a:hover {text-decoration: underline; color: black;}
    Good design should never say "Look at me!"
    It should say "Look at this." ~ David Craib


    http://digitalinsite.ca ~ my current site . . info@digitalinsite.ca ~ my email

    If you feel that someone's post helped you fix your problem, answered your question, or just made you feel better, feel free to "Like" their post. The "Like" link is at the bottom right of each post, along side the "reply" link. And if you are being helped here, try to help someone else - pass it on!

  4. #3
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Also, make sure your CSS file is saved in a css folder and called slide1.css. I've seen cases where the file was named Slide1.css or slide-1.css and thus generated a 404 (the former on Linux servers).
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  5. #4
    Member
    Join Date
    Mar 2012
    Posts
    50
    Member #
    31189
    Well I it technically works. But....I'm noticing something (if I'm not wrong) ---

    I've set up a separate folder for all css files, etc.. Whenever I try to move code to an external slide, I have to first create the external file - slide1.css in this case - in the main public_html directory. Then link the file to my php pages from the directory.

    Only after this is done can I copy the css file into the css folder and make the appropriate changes in the php link. Otherwise I don't get my code to work properly. Does this make any sense? (I see no logical reason why) Or is it just my "novice stage" manifesting into delusion lol
    Last edited by acegreen; Sep 03rd, 2013 at 10:00 PM.

  6. #5
    WDF Staff AlphaMare's Avatar
    Join Date
    Oct 2009
    Location
    Montreal, Canada
    Posts
    4,570
    Member #
    20277
    Liked
    878 times
    I'm stumped - I know we generally frown on link drops, but in this case - can you post a link so I can see the code in action?
    Good design should never say "Look at me!"
    It should say "Look at this." ~ David Craib


    http://digitalinsite.ca ~ my current site . . info@digitalinsite.ca ~ my email

    If you feel that someone's post helped you fix your problem, answered your question, or just made you feel better, feel free to "Like" their post. The "Like" link is at the bottom right of each post, along side the "reply" link. And if you are being helped here, try to help someone else - pass it on!

  7. #6
    Member
    Join Date
    Mar 2012
    Posts
    50
    Member #
    31189
    Quote Originally Posted by AlphaMare View Post
    I'm stumped - I know we generally frown on link drops, but in this case - can you post a link so I can see the code in action?
    Lol ... well the code works now. So I really wouldn't be able to show. Those are only the steps I went through. It's most likely a mistake at my end. Frankly, late nights are the only time I can learn to code.

    While I distract your attention to another issue lol... I'm trying to combine a fade css and text links into a footer include (for my footer)...

    My "fade" script (which is external) is:
    .fade {
    opacity: 0.5;
    transition: opacity .25s ease-in-out;
    -moz-transition: opacity .25s ease-in-out;
    -webkit-transition: opacity .25s ease-in-out;
    }

    .fade:hover {
    opacity: 1;
    text-decoration:underline;
    text-color:black;
    }
    my footer include is:
    <link rel="stylesheet" type="text/css" href="css/fade.css" />

    <style type="text/css">
    .fade a:link { text-decoration: none; color: white;}
    .fade a:visited {text-decoration: none;}
    .fade a:active {text-decoration: none;}
    .fade a:hover {color: black;}
    </style>
    </head>

    <body>
    <p class ="fade">
    <a href="link0.php">link0</a> | <a href="link1.php">link1</a> | <a href="link2.php">link2</a> | <a href="link3.php">link3</a> | <a href="link4.php">link4</a>
    </p>
    The above works, but not the way I want it. If I hover over, say, link3, that link changes color. This is good. But all the links get underlined and their opacity increases to 1, together. I want the changes to be made only to the link that the user hovers over, My "experiments" indicate <p> is the culprit. Unfortunately I don't really know of any other tags to use that would limit the effects only on the links themselves. Sorry to switch topics on you like this, btw.
    Last edited by acegreen; Sep 03rd, 2013 at 11:26 PM.

  8. #7
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Change
    Code:
    .fade:hover{
    to
    Code:
    .fade a:hover{
    Quote Originally Posted by acegreen View Post
    Frankly, late nights are the only time I can learn to code.
    That's been me for several years.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  9. #8
    Member
    Join Date
    Mar 2012
    Posts
    50
    Member #
    31189
    Quote Originally Posted by Ronald Roe View Post
    Change
    Code:
    .fade:hover{
    to
    Code:
    .fade a:hover{
    I did this and took out <p>. Now I get each link to fade, but I get the generic blue (link) color whether faded or not. So essentially I have to ask what is wrong with my color "coding"?

    Here is the code used (can't tell where I'm going wrong):
    The CSS:
    .fade {
    opacity: 0.5;
    text-decoration: none;
    text-color: white;

    transition: opacity .25s ease-in-out;
    -moz-transition: opacity .25s ease-in-out;
    -webkit-transition: opacity .25s ease-in-out;
    }
    .fade a:hover {
    opacity: 1;
    text-decoration:underline;
    text-color:black;
    }
    The php (used as an include file on the pages):
    <link rel="stylesheet" type="text/css" href="css/fade.css" />

    </head>

    <body>
    <div style="width:300px;margin:auto 35px auto auto;" >
    <a href="link0.php" class ="fade">Link0</a> | <a href="link1.php" class ="fade">Link1</a> | <a href="link2.php" class ="fade">Link2</a> | <a href="link3.php" class ="fade">Link3</a> | <a href="link4.php" class ="fade">Link4</a>
    </div>
    Could the problem be because these two files are each in two different folders in my public_html?
    the CSS is in public_html/css/fade.css and the footer include is in public_html/inc/footer.php

    Please help...
    Last edited by acegreen; Sep 04th, 2013 at 11:49 PM.

  10. #9
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Code:
    text-color
    isn't a thing. The correct declaration is:
    Code:
    color:white
    It's like that because color refers to foreground color, not necessarily text.
    TheGAME1264 likes this.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  11. #10
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Also, replace .fade a:hover with .fade:hover (or a.fade:hover...both are correct). .fade a only works if .fade is assigned to a parent element (such as a p tag).
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:25 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com