2

I'm very new to coding and web development. I'm working with HTML and CSS at the moment. The trouble is, I can't see what I'm coding.

How do you load a HTML and CSS file onto a local host so that you can see what you are doing?

Really appreciate it if you could give your input. :)

7
  • 1
    just open the html file using your browser..... Commented Dec 22, 2016 at 10:30
  • pls provide your code watever u have done. Commented Dec 22, 2016 at 10:30
  • You just need to open you html using some browser Commented Dec 22, 2016 at 10:30
  • 2
    Possible duplicate of How to open local file in browser Commented Dec 22, 2016 at 10:31
  • Welcome to SO. Please read What topics can I ask about and How to ask a good question And the perfect question And how to create a Minimal, Complete and Verifiable example SO is not a free Coding or Code Conversion or Debugging or Tutorial or Library Finding service Here at SO we fix your attempts, we do not code things for you Commented Dec 22, 2016 at 10:34

5 Answers 5

2

I've had this question as well, haha. But you'll learn.

So there are two solutions here; one using a localhost and one just simply viewing the file.

I'm not sure what device you're on, but to view your file, just simply double click it as you would do to open any other file. Then you will be able to see your code and what you're programming.

The second solution is the use of a localhost; it's basically a test environment for your website to view it during development.

To set up a localhost on a Macintosh device, you simply go to the Finder and search for Terminal, later open it and write; python -m SimpleHTTPServer.

If you have a folder for your files as well (which is recommended for future reference), just use cd and type where it is. The easiest method would be placing it on the Desktop, and then write in the Terminal; cd Desktop -> cd the-folder-you-have-your-code-in and then write python -m SimpleHTTPServer.

To access this server, just type localhost in the search bar where you'd search for items on the web.

Hope this helps you, and welcome to the developing society!


For future reference, when you become a full-fledged developer, don't use Homestead/Laravel, it's a pain in the ass when you don't understand it. Use WAMP, MAMP, or XAMPP based on what device you're on.

Sign up to request clarification or add additional context in comments.

1 Comment

This is the best answer for newbies! I was just practising some html and css (i am a back end dev-noob), and generally i set up a create -react-app, but this is much simpler and the only thing remains is hot-reloading, which i'll be doing soon . Cheers! For linux folks> command is - python3 -m http.server
0

Just open the html file with your browser. On Windows, in Windows Explorer right click on the file and choose open with, then choose your browser.

2 Comments

if there are only sentences in the answer then make a comment rather than answer.
@BhavinShah answer can be one liner too.. Its only non answers like suggestions, try this , may be kind of answers that are not encouraged
0

file:///[complete path to your file] does the trick in Chrome, Firefox and IE, but as @Atrix said, right click + open in [your favourite browser] works too.

You might want to install a full-fledged webserver one day or another though, like Apache or nginx. You also have full stacks servers available (usually coming with a PHP interpreter and a database server), like WAMP (on Windows), or XAMPP (on Windows, Linux and MacOS)

Comments

0

You can do the following:

On a Window machine at the prompt type start the-HTML-file-name

Comments

0

Here is an efficient alternative:

Go to W3Schools Tryit Editor. Wait for the page to fully load. Then enter the following line in the browser's console and press Enter:

document.getElementById('textareawrapper').setAttribute("onkeup","submitTryit(1)")

Now start typing your code in the text area. This is far better than working with a text editor as it shows the output directly as you type.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.