My stylesheet is not working

When i design web page i locally specify styles within the in head section later i will cut & paste in other file(“style.css”) using
( link rel=“stylesheet” type=“text/css” href=“style.css” )
but it wont work.we can call styles using other files & locally using in head section & also within the tags(“<span style=‘color:red; font-size:18px;’”).
can any one help me why it is not working & how to fix it.

How are you testing your local pages? Do you have a local server set up (XAMPP, WAMP etc)?

Make sure this is the right path to the CSS also. If you have your CSS in a folder called ‘CSS’, for example, the path should be href="CSS/style.css".

1 Like

Yes iam working on xampp

No i mentioned right path then also it failed to load styles.

Can you show some code? I’m sure it will be something simple.

<style>
.menu li {
    float: left;
	font-size: 16px;
}
.menu li a {
    display: block;
    text-align: center;
    padding: 12px 14px;
    text-decoration: none;
	color: white;
}
.menu li a:hover:not(.active) {
    background-color: gray;
	color: white;
}
.menu li a.active {
    color: yellow;
    background-color: #4CAF50;
}
.fa-facebook:hover{
    background-color: #3B5998;;
	border-radius: 30%;
}
.fa-twitter:hover {
    background-color: #4099ff;
	border-radius: 30%;
}
.fa-linkedin:hover {
    background-color: #0094BC;
	border-radius: 30%;
}
.home
{
	margin-left: 10%;
	margin-right: 10%;
	margin-top: 20px;
	margin-bottom: 20px;
	border: 2px solid #ed6868;
	padding: 20px;
}
</style>
</head>
<body>
....
</body>
</html>

XAMPP uses PHP so immeditately before the <link …>

Try this to find the path then set a relative path to the style sheet;

<?php echo getcwd(); ?>

The relative path is …/ to go to the parent.
of maybe …/assets/css/style.css at the same level.

When you cut and paste your styles from the head section to your style sheet, are you remembering to omit the <style> tags?

The code you posted shows css within <style> tags in the HTML page.
I thought the problem was with a linked external CSS file. Can you clarify the problem?

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.