What’s the difference between writing the styling codes in the html file and css?

Asked

Viewed 55 times

0

Have any problem writing the styling codes in the file .html (in the <head><style></style></head>) instead of writing to the file .css? I’m having a problem with my codes when I’m going to put a link in tags that needs to use the attribute href, only work this way of writing: href="C:\Users\NomedoUsuario\Desktop\Pasta\arquivo.css", instead of the form that is commonly taught that is: href="arquivo.css" (if it is in the same folder). The way I managed to circumvent this problem is to use the first example of writing. This wouldn’t be a problem if it worked when you put it on a server, but it doesn’t work. And when I put the styling code on it html worked. But I don’t know if there’s a problem with this way of dodging the problem with my code. Is it a problem or a mistake to do this? Is my code the problem? Or does it happen to you? Does anyone have any indication how to fix it?

  • There are other questions about the subject besides those mentioned above, I suggest you do a search

  • @Bacco Ok, thank you so much for the tip. But do you know what the problem is occurring in my code? That I can’t connect the file .css with the .html. As I said the only solution I found was writing in a way (since "C:") that when I put it on a server, the code does not work. If I solved that problem, many other problems I have would be solved.

  • 1

    Most likely you are missing the file path, but only with what you have in the question is impossible to measure. The best test you do is to test by typing the file in the browser to see if it opens (on the server). Example: if css is "nameserver.com.br/styles/.css file" a href="/styles/.css file" is supposed to work. Now, if you don’t set up a server on your machine with the same hosting server structure, it’s kind of hard to develop.

  • @Bacco The problem was not this but his comment helped me to solve. kskkkskskskkksks was worth, I solved in the shit. It was time that I was breaking my head, but it was a very stupid problem. But thanks! To here laughing alone so simple it was...

1 answer

-4

use the tag <link rel="stylesheet" href=""> instead of the tag <style></style> and yes, there is difference in separating files and using everything in the same file

  • 1

    I could also describe what the differences are and why it recommends using one and not another?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.