I'm learning how to code but cant seem to be able to work CSS with HTML and was wondering if anyone here did? I looked at other sites that were about code and I either couldn't get access to the forum (codecademy) or I was just put off by how many years it took for others to get a reply. Since you guys seem to be sciency I figured maybe someone here could help?
Hello world
My CSS is in a seperate file called style.css
h1{
color:Blue;
}
Subscription Note:
Choosing to subscribe to this topic will automatically register you for email notifications for comments and updates on this thread.
Email notifications will be sent out daily by default unless specified otherwise on your account which you can edit by going to your userpage here and clicking on the subscriptions tab.
Sorry my codes only showing Hello world
This is what's supposed to be showing in the original post, sorry
Attachments
Attach Image/Video?:
The link part is where I'm having issues
@ Miss AUS
You left out the name of the CSS file. Here is a sample from one of my HTML files.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Favorite Quotes at AR</title>
<link href="styles/atfontface.css" rel="stylesheet" type="text/css" />
<link href="styles/styles.css" rel="stylesheet" type="text/css" />
<script src="jsfiles/ssm.js" language="JavaScript1.2"></script>
<script src="jsfiles/ssmItems.js" language="JavaScript1.2"></script>
<style type="text/css">
<!--
A.ssmItems:link {color:#cccccc;text-decoration:none;}
A.ssmItems:visited {color:#cccccc;text-decoration:none;}
A.ssmItems:hover {color:#ffff00;text-decoration:none;}
A.ssmItems:active {color:#cccccc;text-decoration:none;}
//-->
</style>
</head>
rmfr
EDIT: Took a while to figure out how to get the post to work. Notice the bold text.
Are you referring to href="style.css"? Cause I used href="HTML/style.css" but when I went to view page source it said file was not found but was fixed when I just did style.css
The
is telling the browser to look in a directory/folder named "HTML" in order to find "style.css" file. If the HMTL file is in the same directory/folder as the CSS file, then it should only be
rmfr
I think I might have a problem cause my css file is inside my HTML folder
If you want it inside the HTML file, put it between STYLE tags like this
within the HEAD tags.
rmfr
EDIT: had to fix blockquote tags
Thanks but I'm trying to use an external link to CSS
Another problem is the
should be
rmfr
I had stylesheet at the start but I read on a thread that it could be cap sensitive so to try StyleSheet instead, thats why I had it changed. I just changed it back and it still didn't work. Thanks but
Also remember the difference between "relative" paths and "absolute" paths. Here is an example of my directory/folder structure (see attached image).
Notice my main folder is "WT3" and that is where all my HTML files are located.
My stylesheets are located in the subfolder "styles". Thus to link to the stylesheets, I have to use this
to link to the stylesheets. Notice the bold text. If my stylesheets were located in the main folder "WT3", then I would need to use this
to link to the stylesheets.
rmfr
Attachments
Attach Image/Video?:
If your stylesheets were located in the main folder "WT3" why would the href be called "atfontface.css", sorry I'm a little confused. Also confused about what to change
"atfontface.css" is the name of one of my stylesheets. For yours, use "styles.css". Or, whatever the name of the stylesheet is.
Also, try taking out the "spaces" between the "=" sign. That might be another problem in the "form" & "input" & "textarea" tags.
HTML tags should follow this format
No spaces between the "=" sign.
rmfr
Thanks I'll try that :)
No it didn't work
Something I have done before. Did you save the file "styles.css" in the same folder as the HTML file? Can't even tell you how many times I have saved files in the wrong location.
rmfr
Yes I did that! Are they supposed to be separate?
As in separate files? Yes. One named "myfile.html" and the other "mystyles.css". Of course, your filenames would be different.
rmfr
If your image is still correct, then the
at the very top should be
rmfr
My fault. Was not looking good enough
If your image is still correct, then the
at the very top should be
No exclaimation point.
rmfr
Never mind me dumb ass self. You have it correct. DUH!
rmfr
Just an update I tried moving my style.css file out of my HTML folder with my HTML file in it and it just said that the file could not be found so I put it back and it looks like its fine now, but the header still wont change colour
Sorry I don't work with css.
Try this.
Instead of this
use this
See if putting a space after the "h1" works.
Here is a sample I used in my stylesheet. My formatting style differs, but is essentially the same.
/* Headers */
h1 { font-family: "Times New Roman"; font-size: 28pt; font-style: italic; font-weight: bold; text-align: left; color: #0066ff; }
h2 { font-family: "Times New Roman"; font-size: 24pt; font-style: italic; font-weight: bold; text-align: left; color: #0066ff; }
h3 { font-family: "Times New Roman"; font-size: 20pt; font-style: italic; font-weight: bold; text-align: left; color: #0066ff; }
h4 { font-family: "Times New Roman"; font-size: 16pt; font-style: italic; font-weight: normal; text-align: left; color: #0066ff; }
h5 { font-family: "Times New Roman"; font-size: 14pt; font-style: italic; font-weight: normal; text-align: left; color: #0066ff; }
h6 { font-family: "Times New Roman"; font-size: 10pt; font-style: normal; font-weight: normal; text-align: left; color: #0066ff; }
Sorry if it seems like I abandoned you last night (for me) but when I am suffering from a migraine, I tend to "cat nap" and wake up at odd times for a short time.
rmfr
Oh it's no worries, it was like 11-12 where I was I just thought you went to sleep. I tried the space between the h1 and no dice
IT WORKED XD I retried doing what you said about it being in a separate folder so I made an new one in a separate folder and it worked. Omg thank you so much!
@ Miss AUS
Da nada. If I can, I am always willing to help.
And yeah, I am about 9 hours behind.
rmfr