0

The problem that I have is that I have some code that defines a website and that defines its constituent stylesheet. I have linked the stylesheet and have a function for wordpress written, to enqueue the stylesheet, however it doesn't seem to want to load. When I try to apply the style without a

<link href="styles.css" rel="stylesheet" type="text/css"> 

it does not apply any style, wheras, if I do include it, developer tools display an error:

"Error : Resource interpreted as Stylesheet but transferred with MIME type text/javascript:"

The main.php page in question:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>main</title>

<link href="styles.css" rel="stylesheet" type="text/css">


<style type="text/css">
.header
{
background : #FFFFFF;
background : rgba(255, 255, 255, 1);
width : 100%;
height : 98pt;
}

.image
{
background-image : url(image.png);
position : relative ;
left : 52pt;
top : 133pt;
width : 19pt;
height : 20pt;
}


images {
width: 70%;
}
</style>

</head>
...

Then the functions file:

<?php

function SetStyles() {

wp_enqueue_style('style',  get_stylesheet_uri() );

}

add_action('wp_enqueue_scripts', 'SetStyles'); 

And finally, the start of styles.css:

@charset "utf-8";
.images {
width: 59%;
display: block;
float: right;
font-size: 59.87pt;
font-family: "Mrs Eaves OT", "Mrs Eaves Small Caps OT";
font-variant: small-caps;
}

}
.links {
clear: right;
vertical-align: baseline;
width: 72%;
height: 25px;
float: right;
font-family: "Futura PT Light";
font-size: 25px;
word-spacing: 30px;
...

Would really appreciate someone helping me out, its been driving me mad. Edit: I should also add that the styles do appear to be correctly displayed in my DreamWeaver editor, only is it in browser that they dissapear.

2 Answers 2

1

You're using wp_enqueue_scripts instead of wp_enqueue_style. Thus, WordPress wraps your resource into javascript mime type.

Pay attention to your error messages. Question everything.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your response! Though it doesn't seem to be the issue, as I tried changing it to no avail. It looks like the error is present at <link href="styles.css" rel="stylesheet" type="text/css">
0

What the name of your stylesheet style.css or styles.css ?? If it is styles.css change the below line in your code

wp_enqueue_style('styles',  get_stylesheet_uri() );

This will look for a stylesheet named “styles” and load it, also make sure your stylesheet is in your theme’s root directory.

Hope this helps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.