0

I've written a piece of CSS, while it does not affect the way my page(s) are displayed. I use in my HTML tag:

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

And my style.css file looks like this:

@import('CSS/modal.css');
@import('CSS/menu.css');
@import('CSS/content.css');
@import('CSS/footer.css');
@import('CSS/title.css');

Yet when I use this:

#title {
  font-size: 5em;
}

To test if it really doesn't load the CSS.

On this part of HTML:

 <body>
    <div id="title">
      AMP
    </div>
 </body>

It still doesn't display the text in 5em.

EDIT: It seems that when I put the CSS3 code directly into style.css and do not let it run over the @import() function, it does load correctly, but why is it not working anymore? It worked fine yesterday, it has always worked perfectly.

2
  • 1
    Are the imported CSS files in a directory called CSS relative to the style.css file? Commented Aug 23, 2013 at 14:24
  • 1
    Are those CSS files really in a CSS directory? Is the directory titled all uppercase like your links are? Try all lowercase "css". Your server may be set up as case sensitive. Commented Aug 23, 2013 at 14:25

3 Answers 3

3

Remove .css from your selector:

#title {
  font-size: 5em;
}

#text.css selector means "select an element that has both title id and css class".

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

3 Comments

Ah, that was stupid of me to put in. But even after removing it it is not changing. I've pressed F5, closed the browser, everything. This is also not the real CSS3 code I'm speaking of, I've written a much larger piece. But since that didn't apply I tried to use the little title.css to see if it was something in the other script (modal.css) or something else.
@JesseDijkstra: Are your folder paths correct? You have href="style.css" and @import('CSS/title.css');.
@thirtydot: Yes, this is valid, and has always been. Since you're refering to a folder that is called CSS and within that folder you search for the (in this example) 'title.css' file.
1

You have at least two mistakes.

This:

#title.css {
  font-size: 5em;
}

should be:

#title {
  font-size: 5em;
}

And this:

@import('CSS/modal.css');
@import('CSS/menu.css');
@import('CSS/content.css');
@import('CSS/footer.css');
@import('CSS/title.css');

should be:

@import 'CSS/modal.css';
@import 'CSS/menu.css';
@import 'CSS/content.css';
@import 'CSS/footer.css';
@import 'CSS/title.css';

@import url('CSS/title.css'); and @import 'CSS/title.css'; are both valid forms. What you have is not valid.

Comments

0

Try:

#title {
 font-size: 5em;
}

The Jsfiddle here works: link

1 Comment

Somehow it now perfectly enlarges the text to 5em. But why is the '@import('');' not working any more? It worked before.

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.