Css does not stay in HTML

Asked

Viewed 381 times

0

How do I load this HTML with CSS on another device. On my pc it loads the normal css, but when I have a friend open it for me, I send her only the HTML file and only the HTML appears. How do I load the css together???

<head> 
    <link rel="stylesheet" type="text/css" href="C:\Users\PhodZ\Documents\Codes\Tests/css.css">

</head>
<form action="" method="POST"></form>

<h1 id="test">

</h1>
<div id="testb">

</div>
<div id="teste">
    <label for="testea" id="testea">Nome</label>
    <input type="text" id="aaa" />
</div>

2 answers

2


I’m guessing I can’t send her the 2 files (HTML and CSS), correct?!

We have 3 options!

1) Tag content of CSS file within the

This way only the HTML file will be enough.

<head>
  <style> SEU CONTEUDO DO ARQUIVO CSS </style>
</head>

2) Publicly place CSS on a web server or cloud (e.g., Google Cloud Storage) and on href from the CSS link, paste the CSS URL. In this case, it needs to have internet connection for the file to be loaded!

<link rel="stylesheet" type="text/css" href="http://meuservidor/meuarquivocss.css">

3) Use an online editor such as https://jsfiddle.net/, and share with her.

I hope it helps!

  • DEAR I LOVE YOU IN A WAY!!!! THANK YOU!!!!!!

  • but wait, it has a free server?

  • Google Cloud Storage is free to test! https://cloud.google.com/storage

-1

This is Pedro, welcome to pt.stackoverflow!

When we refer to a stylization CSS external type (the way you are using), the attribute href indicates the path to which file CSS should be read and interpreted.

When you pass only the file .html for your friend, when running it on her machine, in the construction of HTML, the interpreter will read this <link> and search for the file in the following directory C:\Users\PhodZ\Documents\Codes\Tests/css.css, however it will not be found. So the file only interprets the HTML code.

  • Remembering that in case you send the file css, it must be in that same directory: C: Users Phodz Document...

  • okkk, and how do I solve this?

  • making the css continue from the external type and load

Browser other questions tagged

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