0

i made a website by wordpress and i uploaded it to ftp file

public html

my problem is that i made a css file that include all the other css files but when i tested the website i found that the wordpress didnt see the it saw only the first one what should i do to make the website see my files this is what is incuded in css file should i add url('wordpress/webcontent/....') or there is another way ??

style.css

@import url('/styles/forms.css');
@import url('/styles/tables.css');
@import url('/styles/homepage.css');
@import url('/styles/reset.css');
@import url('/styles/stimenu.css');
@import url('/styles/layout.css');
@import url('/styles/demo.css');
3

Try to use relative URLs to your imported css files. So try to remove first / from each import URL:

@import url('styles/forms.css');
@import url('styles/tables.css');
@import url('styles/homepage.css');
@import url('styles/reset.css');
@import url('styles/stimenu.css');
@import url('styles/layout.css');
@import url('styles/demo.css');

Also pay attention to the fact that using @import directives is bad practice and strongly not recommended to use. Use link instead of it. Why? Read here: @import vs link.

So in your I strongly recommend you write your code like this:

add_action( 'wp_enqueue_scripts', 'wpse8170_enqueue_scripts' );
function wpse8170_enqueue_scripts() {
    $baseurl = get_template_directory_uri(); // if you write plugin use plugins_url();

    wp_enqueue_style( 'wpse8170-forms', "{$baseurl}/styles/forms.css" );
    wp_enqueue_style( 'wpse8170-tables', "{$baseurl}/styles/tables.css" );
    wp_enqueue_style( 'wpse8170-homepage', "{$baseurl}/styles/homepage.css" );
    wp_enqueue_style( 'wpse8170-reset', "{$baseurl}/styles/reset.css" );
    wp_enqueue_style( 'wpse8170-stimenu', "{$baseurl}/styles/stimenu.css" );
    wp_enqueue_style( 'wpse8170-layout', "{$baseurl}/styles/layout.css" );
    wp_enqueue_style( 'wpse8170-demo', "{$baseurl}/styles/demo.css" );

    wp_enqueue_style( 'wpse8170-style', "{$baseurl}/style.css", array( 'wpse8170-forms', 'wpse8170-tables', 'wpse8170-homepage', 'wpse8170-reset', 'wpse8170-stimenu', 'wpse8170-layout', 'wpse8170-demo' ) );
}
| improve this answer | |
  • do you mean that i should add this function to function.php ?? – sarah Feb 27 '13 at 10:01
  • @sarah yes i do – Eugene Manuilov Feb 27 '13 at 10:03
  • ok thanks but should i need to add something to the header to make it see this code ?? – sarah Feb 27 '13 at 10:05
0

Since your styles folder is in the same folder as your style.css file, the basic problem is the preceding / from the files' paths.

Use @import url("styles/forms.css"); instead of @import url("/styles/forms.css");

This should sort out your problem.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.