/    Sign up×
Community /Pin to ProfileBookmark

CSS not working!

Hello everybody, I am a newbie in web designing, I started learning html, html5 and css in sololearn.com and before 2 days i thought of designing in my own laptop instead of sololearn.com and i installed xampp in my laptop windows 7, everything was working fine untill today morning…

the problem is whatever changing I make in CSS nothing takes effect i have added <link rel=”stylesheet” type=”text/css” <href=”style.css> in the head tag in html5 file.
Both style and html5 files are in same directory. in the browser html shows up but the css is not taking effect, this is so frustrating please can anyone help ?
I tried chrome, firefox, internet explorer with no success ?

to post a comment
CSS

14 Comments(s)

Copy linkTweet thisAlerts:
@noobie361authorNov 29.2016 — 

Correction the code is <link rel="stylesheet" type="text/css" href="style.css>

I don't know how to edit posted thread here
Copy linkTweet thisAlerts:
@Kevin2Nov 29.2016 — &lt;link rel="stylesheet" type="text/css" &lt;href="style.css&gt;
If that is really what you have in your HTML remove the [B]<[/B] from in front of [B]href[/B] and you're missing the closing quote on your filename. Also, in HTML5 you don't need the type attribute on a <link> to a stylesheet. This should work:

&lt;link rel="stylesheet" href="style.css"&gt;
Copy linkTweet thisAlerts:
@noobie361authorNov 29.2016 — those are the mistakes i made in typing in thread, in html file everything was correctly written, still I copy pasted your tag in my html and tried again.. no success ?

ofcourse i removed the previous code and pasted your code..
Copy linkTweet thisAlerts:
@noobie361authorNov 29.2016 — thank you for sharing those links kevin!

this is so confusing, html and css gave no errors on those links and it doesn't take effect in webserver this is so confusing what might be the problem ?
Copy linkTweet thisAlerts:
@shakazorbaNov 29.2016 — some times problems like yours can be

corrected by clearing the browser data

it may be using a cached version of

your css ?

also set the server response headers

to no-cache to make sure it doesn't

happen again.
Copy linkTweet thisAlerts:
@Kevin2Nov 29.2016 — Common mistakes:
[LIST]
  • [*]Stylesheet file is [B]not[/B] in the place specified in the <link> tag. I know you stated it was in the "same directory", but double-check.

  • [*]Incorrect file name. style.css is not the same as styles.css is not the same as Style.css

  • [/LIST]


    As shakazorba points out you may be pulling a cached version of your stylesheet; make sure to do a "hard refresh" when making changes to your stylesheet. ?

    If that doesn't help, post your code (using the forum BB tags ?)
    Copy linkTweet thisAlerts:
    @noobie361authorNov 29.2016 — double checked the file name, rewrote the whole code, tried hard reset....... No Success ?

    I tried all of these right now as you guys suggested ..

    I have included the code below its very basic

    and i don't know how to use BB code I am new to forums

    [code=html]<!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title> Safetix-Securite</title>
    <link rel="stylesheet" href="style.css">
    <meta http-equiv="refresh" content="3">
    </head>
    <body>
    <p class="g">THIS IS A TEST</p>
    </body>
    </html>[/code]


    [CODE]#g {
    color: aqua;
    }[/CODE]
    Copy linkTweet thisAlerts:
    @Kevin2Nov 29.2016 — In your stylesheet change [B]#g[/B] to [B].g[/B]. You have <p class="g"> in your HTML but are using ID nomenclature in your css. Of course the reverse is true as well: If you change <p class="g"> to <p id="g"> and leave the CSS alone it should work.
    Copy linkTweet thisAlerts:
    @noobie361authorNov 29.2016 — THANK YOU SOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO MUCH Kevin. that really helped ! I was so terrified because of this problem !

    And would you mind explaining about this ID nomenclature thing ?
    Copy linkTweet thisAlerts:
    @noobie361authorNov 29.2016 — How can i mark this thread solved ?
    Copy linkTweet thisAlerts:
    @Kevin2Nov 29.2016 — The difference between Class and ID can be really confusing. An ID can be used once per page, [B]class[/B] as many as you want/need. Those are the rules, live with them ?. ID is mostly useful for scripting (javascript et al), but has its uses elsewhere, including CSS.

    As far as nomenclature goes, here's a quick explanation using your code --

    For [B]class[/B]
    [code=html]<p class="g">blah</p>[/code]
    the corresponding CSS:
    .g {
    color: aqua;
    }


    For [B]ID[/B]
    [code=html]<p id="g">blah</p>[/code]
    the corresponding CSS:
    #g {
    color: aqua;
    }
    Copy linkTweet thisAlerts:
    @noobie361authorNov 29.2016 — Thank You so much Kevin you are great !
    Copy linkTweet thisAlerts:
    @Kevin2Nov 29.2016 — Well, I wouldn't go that far... I'm adequate at the most!

    Best of luck to you!

    Kevin
    ×

    Success!

    Help @noobie361 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.18,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...