What is the html code to reference a css file in a folder on my desktop?
anonymous
2010-10-21 21:36:42 UTC
I am new to developing as this question is basic i think. I downloaded a css template and want to start building a website. However, I have no idea how to have this show when running my current project. The file is in a folder on my desktop. How do I use a css template and how do I reference the file so that when I run it it works. I am using Aptana Web....
Three answers:
Yvette!
2010-10-24 08:05:28 UTC
You should have everything in a root folder (all your html's, css, images, any other coding files) and then in that folder an images folder where you put your images. And then you can simply put in the header section of your html file-
which will link your html to your css.
Then in your css, if you want to link to an image, which is in your image folder you put for example
#divname
{
background-image:url(images/imagename.png);
background-repeat: repeat-y;
}
this div will be called on by the html if you have
in your html.
If you put everything in the one place you don't need to have long and complicated file paths, and it also makes managing your website easier.
**And you can just use notepad for all this. I like to use dreamweaver because it colour codes things which can get handy when your code is 100's of lines long.
?
2010-10-24 06:30:02 UTC
I'll start at the basics for you.
Say for example you have two files. One is a html file named "index.html", and the other is a css file named "styles.css". And they are both located inside a folder here "C:\www\mywebsite\".
So your directory structure looks like this:
C:\www\mywebsite\index.html
C:\www\mywebsite\styles.css
At the top of your html files, you can link to your css file like this:
You should follow these tutorials: http://htmldog.com/
And here too: http://www.w3schools.com/
They will help you a GREAT deal.
After you learn HTML and CSS, then you can start playing with javascript. jQuery is my favorite framework.
By the way, you can get rid of the bloated software Aptana. It's a great IDE, but if you are just starting out, you really need something simpler and basic.
Years ago, I learned to do things the HARD WAY, with a featureless text editor.
That's all HTML and CSS are, just plan text! You can hand-code any website with just a plain text editor.
Almost ten years later, my editor of choice is Notepad++, you can learn more about it here: http://notepad-plus-plus.org/
And you want a decent CSS editor too, you can try TopStyle Lite: http://notepad-plus-plus.org/
Best of luck to you.
Building websites is just the beginning of a rewarding career.
I freelance and couldn't be happier :D
?
2010-10-22 04:47:16 UTC
Css File
body { background:cyan;
color:white;
}
h1 { font-style:italic;
}
put the below code in HTML file head section.
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.