This forum is now read-only. Please use our new forums! Go to forums
I understand the concept of saving a text file as html but how can i view my html rendered with the css?What do i save the ccs file as? How do i link that to my html? and How do i view both in a browser?
Answer 4faf9415d66f8f000300a908
votes
In your html write: <link rel="stylesheet" href="style.css" />
and keep the style.css
and the html file in the same folder.
Just open the html file with any browser (double-click). Some text-editors also allow the option of running the code in a browser.
And to save a file as a css file you save it with the extension .css
.
Answer 4faff0c4e34b3000030113e4
votes
Hi, thanks for the help but i have now tried this and it still doesn’t work. I dont get any ccs, my images are not shown and its full of dashes ///.I even tried including (type=”text/css”) as they used in the lesson.I think the problem is as i open the html file in a browser, the ccs is just left behind in the folder. Im not even sure anything looks for it! It seems a odd system to get one file type to run with completely different file type!I know the code is good because its all copied from my final lesson. Any other ideas?
Mike
Answer 4faffc7d9665500003012b76
votes
Show me your relevant html code and some code from your .css file (are you sure it’s named something.css and the computer recognizes it as a “cascading style sheet document”?).
And it’s not “ccs”, it’s “css” which stands for cascading style sheets.
This process I described works for me, and it is very logical it should for you. I’m partly guessing here but: When you link to style.css
you are telling the browser reading the html
to look in the folder the html
is stored, in contrast you could link to perhaps another folder (but I’m not sure the browser can read other folders than subfolders, e.g.
<link rel="stylesheet" href="public\site2\styleForSite2.css" />
). This example would tell the browser to look for the css file styleForSite2.css in the folder site2 (which is a subfolder of the folder public).
Another thing I could suggest is try linking to a stylesheet online to try to isolate the problem better (it was done in some exercise, don’t remember which).
Answer 4fb014aacbb69c00030027cd
I will admit at first i mistakenly typed .ccs but soon realised my mistake and saw the file change into a .css. Thanks for the tips, I will keep trying.
Answer 4fb01f1172d6850003015ea1
Answer 4fb021f96154580003015ce5
votes
Update: I just downloaded tumult hyperedit and tested my code in there and it all looks fine!So the problem must be where it comes to the browser interpreting my code! Maybe its because im using safari and it needs a different link code?I’ll try internet explorer tomorrow.
Answer 4fba609e511af30003027b92
votes
@mikedeuk Try out www.tinkerbin.com. It’s a site which lets you play with HTML, CSS, and even Javascript all in the same window, and it auto-updates to render your changes in real-time. It’s really easy to use and very convenient when the Codecademy windows are buggy.
Popular free courses
Free Course
Learn SQL
Beginner friendly,
4 Lessons
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.
Language Fluency
Free Course
Learn JavaScript
Beginner friendly,
11 Lessons
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
Language Fluency
Free Course
Learn HTML
Beginner friendly,
6 Lessons
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.
Language Fluency