Support » Themes and Templates » CSS and @import mycss.css

  • I am very new to this and I am struggling a lot.
    I want to add my own CSS file, to use with blogs.
    I am using Classic 1.5 by Dave Shea
    I added @import url ('mydir/mycss.css') to the end of style.css in wp-content/themes/classic

    It does not appear to be working.

    I expect it is my path designation, but whatever I try it does seem to find it.

    body {
    	background: red;
    	font-size: 2em;

    I assumed this would modify at least some of the output on the page.

    Any pointers appreciated.


Viewing 9 replies - 1 through 9 (of 9 total)
  • Did you create /mydir in the classic template directory?

    Yes I did

    Thanks for answering


    Don’t know if that space between url and ( are causing the problem.

    Otherwise try add the stylesheet outside of the CSS file in the header.

    <link rel=”stylesheet” href=”<?php bloginfo(‘template_directory’); ?>/mycss.css” type=”text/css” media=”all” />

    And try add !important at the end of the lines to see if it’s a problem of hierarchy.

    body { background:red !important; }


    I was searching around for a solution and I realized that you added the @import declaration to the end of the style.css.

    @import rules must always be first in a document… try moving it to the top of the file.

    To override styles that may have been defined subsequently, you can always add a !important with each declaration..


    body {
    background: red !important;
    font-size: 2em !important;

    Thanks for all the replies.

    I tried moving the @import to the start of style.css
    and I moved my mycss.css to the same directory as style.css, so now they are both in the same directory.

    my style.css now has @import url(‘mycss.css’) on the first line before the comments.

    I created a class of mine and used it on a blog

    <P class=”tt_one”>This shoulbe red and 3ems</P>

    But still it is not working.

    I do not know where to put the <LINK part, but I guess that means editing php files and I was trying to avoid that.

    Apologies if I am being extremely stupid and not understanding some fundamental design aspect.




    Forum Moderator

    Your custom CSS is probably being over-written by the default styling further down style.css.

    Suggestion: Copy the complete style.css file – except for comment section at the top – and save the copy as a new file in your theme directory called default.css.

    Next, remove all CSS content from style.css but make sure that you leave the comment section intact. Below this section add:

    @import url(default.css);
    @import url(mycss.css);

    This will cause your custom css to load after the default styling and always take precedence. Just make all future changes to mycss.css in future.

    The last suggestion seems a clean solution to adding my changes.

    I have now got something happening, so thank you all again for your help.


    My idea of formatting my blogs has been severely shattered.

    My blogs are articles about trees and I wanted them in a standardised format, which I would bulk import as CSV files, which I would create from my existing Access Database.

    It seems the blog page has a mind of its own, in how it interprets HTML tags.

    I wanted initially to use a table layout, but I discovered that was not supported, so I worked out a layout using <P> tags and CSS, but sometimes they work and sometimes they are ignored and sometimes they just get lost altogether and do not appear. Research on here has told me that, my problems, are not unique.

    Can anyone recommend any way to do what I want, without getting involved in PHP and new Themes. I am running version 2.8.5 on a hosted ISP.





    Forum Moderator

    It seems the blog page has a mind of its own, in how it interprets HTML tags.

    It’s far more likely that it’s the CSS in your theme that’s the issue – assuming, of course, that your markup is valid. Can you post a link to a page demonstrating some of the problems you’re having?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘CSS and @import mycss.css’ is closed to new replies.