Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML HTML Introduction First Steps

Question

I Am using an a special text-editor called atom then when i tried to launch the code that is in my text editor It does not launch. Why?. Notice: when it launches the website it shows nothing only plain website.

Brandon Benefield
Brandon Benefield
7,739 Points

I'm having a fairly difficult time trying to figure out what it is exactly that you are asking. So you're using atom, but when you try to open your website, it just plain white background and no text, images etc.? Is there a button or command in atom that lets you open your html file? I've never used atom so I don't know. Have you tried making another html file, adding in a couple of lines of code and opening it?

Post some code, just your HTML. For all we know you set background and foreground colors both to white.

Here's the code, Brandon

<!DOCTYPE html>

<html>

<head>

<title>Hassan Saeed Portfolio</title>

<meta charset="utf-8">

<link rel="stylesheet" href="main.css">

</head>

<body>

<h1>hello world!</h1>

<em>~Emphasized text </em>

<Script src="main.js"></script> </body> <html>

Brandon Benefield
Brandon Benefield
7,739 Points

Well first things first, your opening <script> tag has a capitalized S. So your page will not link to your JS file.

Secondly, have you tried doing this directly inside the treehouse workspace? I'm getting eveything that's in your HTML from the bold 'hello world!' to the '~Emphasized text' underneath it.

Once again, you have not let me know if you are manually opening the html file yourself. What I mean is, are you double clicking the html file, or are you using a command from atom?

Lastly, just to help others read your code and to make your posts look nicer (which makes others want to help you more), you should reference the "Markdown Cheatsheet" beneath the add comment section. It will help you format your code so instead of a jumbled mess of code, you get

<!DOCTYPE html>

<html>

<head>

<title>Hassan Saeed Portfolio</title>

<meta charset="utf-8">

<link rel="stylesheet" href="main.css">

</head>

<body>

<h1>hello world!</h1>

<em>~Emphasized text </em>

<Script src="main.js"></script>
 </body>
<html>

Also I'd like to add that you have over 1,800 points in HTML, are you really asking this question or is this a joke?

No am used for treehouse workspaces so i this is my first time using a text editor like this got me?

1 Answer

Cole Atkinson
Cole Atkinson
2,854 Points

Hey John, since you are now working on your local machine instead of an online workspace, relative paths will not work. So for instance, you will need to replace

<link rel="stylesheet" href="main.css">

With the actual path to your css file, for instance:

<link rel="stylesheet" href="C:\Sample\Documents\css\main.css">

I'm 99% sure this is your issue, can you let us know?

Brandon Benefield
Brandon Benefield
7,739 Points

Actually you can reference your stylesheets, and JS files relative to where your HTML file is located. If his CSS file is located in the same directory as his HTML file then href="main.css" works just fine and is a lot nicer to read.