I’m Eric and just joined b/c I’m fairly new to web design. I’ve learned JS, CSS, HTML and some Jquery on Codecademy for the past year and am in the process of building a site for my music. I’ve already signed up with ipage.com as a hosting site, I’m going to be doing it from scratch and uploading files to FileSharer. A few questions:
What program does one use for writing html/css/js? Just Wordpad or Notepad? How do you save the file as an HTML file, it doesn’t give that option under Save As.
Can you put your html and css in the same file, or is it better to do them separately? If you do one with css, can you save it as an HTML file? Do you save a Javascript file under HTML as well?
For writing code I use Notepad++, and save the file with Save As “name.html”.
It is better to have the css and js code separately in “.css" and ".js” file, so, you can easily include that code in html pages. You can also write css/js code in html document.
Yes, best to keep CSS and JS separate, as it can then be used on all pages. There are lots of free code editors and some nice paid ones too, like Sublime Text 2.
But you can use the simple text editor that comes with you computer, too, like Notepad on Win and TextEdit on Mac.
You can even just change the file extension from .txt to .html or .css etc. as well.
Try Notepad++. There are options to save documents in all sorts of formats. Some other options are Aptana, Netbeans and Microsoft Visual Web Developer. I would recommend starting off with something like the Microsoft product or Notepad++ if you are a beginner. Some of the other programs are great but hard to use if you aren’t use to programming.
For your second question, in general it is better to keep your CSS and JS files separate however this is not an absolute truth. For example when optimizing a website for speed, it is better to use inline CSS and JS code when that code is not used that often. By contrast, if you have one more http request every time a page loads for CSS or JS that is only used occasionally, you are not using resources optimally.
Further, if you only have a small amount of CSS and JS, it is a best practice to have it embedded either inline or within your HTML document to reduce http requests to the server. Also, remember to put any CSS http requests before any JavaScript requests in your html document.
[FONT=verdana]Regarding your point about there being no HTML option under Save As. An HTML file is essentially just a plain text file that happens to contain HTML code. You don’t need to explicitly save it as HTML. Just a plain “save as text” - or something similar - will do the trick (but be sure to give it an extension of HTML or HTM).
The same applies to CSS and Javascript files. They’re just plain text files. In these cases, the relevant extensions are CSS and JS.
It’s also worth keeping in mind that there are two types of tools for creating these files:
The plain text editors, like Notepad, Notepad++, Programmers Notepad, and TextEdit, where you code the relevant tags by hand.
And the so-called WISIWYG editors, which work more like word processors; for example, if you format some text as bold or italic, you actually see that formatting on the screen rather than <i> or <b> tags or whatever; a good example from this group is free CoffeeCup editor.
For someone starting out, I’d recommend the first of the above, if only because it forces you to learn the relevant coding (HTML, CSS or whatever). The second goup are better for someone who want to create a site but who doesn’t want to learn the underlying language.
To get the best of both worlds, consider Microsoft’s free Web Developer Express. This is essentially a text editor (like Notepad++, etc), but it also has a limited WYSIWYG mode, which is good for doing quick previews and editing small chunks of text.
Just a heads up. I used Notepad++ for a couple of years but just discovered Sublime Text 2 which I find is personally better. Has some great plugins, looks and feels nicer too!