Can I get some help with code?

29 posts / 0 new
Last post
AUS-LGBT's picture
Can I get some help with code?

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.

AUS-LGBT's picture
Sorry my codes only showing

Sorry my codes only showing Hello world

AUS-LGBT's picture
This is what's supposed to be

This is what's supposed to be showing in the original post, sorry

Attachments

Attach Image/Video?: 

Yes
AUS-LGBT's picture
The link part is where I'm

The link part is where I'm having issues

arakish's picture
@ Miss AUS

@ 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.

AUS-LGBT's picture
Are you referring to href=

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

arakish's picture
The

The

href="HTML/style.css"

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

href="style.css"

rmfr

AUS-LGBT's picture
I think I might have a

I think I might have a problem cause my css file is inside my HTML folder

arakish's picture
If you want it inside the

If you want it inside the HTML file, put it between STYLE tags like this

<style type="text/css">
<!--
h1{ color:Blue; }
//-->
</style>

within the HEAD tags.

rmfr

EDIT: had to fix blockquote tags

AUS-LGBT's picture
Thanks but I'm trying to use

Thanks but I'm trying to use an external link to CSS

arakish's picture
Another problem is the

Another problem is the

rel="StyleSheet"

should be

rel="stylesheet"

rmfr

AUS-LGBT's picture
I had stylesheet at the start

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

arakish's picture
Also remember the difference

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

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

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

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

to link to the stylesheets.

rmfr

Attachments

Attach Image/Video?: 

Yes
AUS-LGBT's picture
If your stylesheets were

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

arakish's picture
"atfontface.css" is the name

"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

<tagname attribute="value">

No spaces between the "=" sign.

rmfr

AUS-LGBT's picture
Thanks I'll try that :)

Thanks I'll try that :)

AUS-LGBT's picture
No it didn't work

No it didn't work

arakish's picture
Something I have done before.

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

AUS-LGBT's picture
Yes I did that! Are they

Yes I did that! Are they supposed to be separate?

arakish's picture
As in separate files? Yes.

As in separate files? Yes. One named "myfile.html" and the other "mystyles.css". Of course, your filenames would be different.

rmfr

arakish's picture
If your image is still

If your image is still correct, then the

DOCTYPE html

at the very top should be

<DOCTYPE html>

rmfr

arakish's picture
My fault. Was not looking

My fault. Was not looking good enough

If your image is still correct, then the

<!DOCTYPE html>

at the very top should be

<DOCTYPE html>

No exclaimation point.

rmfr

arakish's picture
Never mind me dumb ass self.

Never mind me dumb ass self. You have it correct. DUH!
rmfr

AUS-LGBT's picture
Just an update I tried moving

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

Nyarlathotep's picture
Sorry I don't work with css.

Sorry I don't work with css.

arakish's picture
Try this.

Try this.

Instead of this

h1{
color:Blue;
}

use this

h1 {
color:Blue;
}

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

AUS-LGBT's picture
Oh it's no worries, it was

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

AUS-LGBT's picture
IT WORKED XD I retried doing

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!

arakish's picture
@ Miss AUS

@ Miss AUS

Da nada. If I can, I am always willing to help.

And yeah, I am about 9 hours behind.

rmfr

Donating = Loving

Heart Icon

Bringing you atheist articles and building active godless communities takes hundreds of hours and resources each month. If you find any joy or stimulation at Atheist Republic, please consider becoming a Supporting Member with a recurring monthly donation of your choosing, between a cup of tea and a good dinner.

Or make a one-time donation in any amount.