Updated on September 29, 2022 This article shows how to view HTML source code in Safari. View Source Code in SafariShowing source code in Safari is easy:
On most web pages, you can also view the source by right-clicking on the page (not on an image) and choosing Show Page Source. You must enable the Develop menu in Preferences for the option to appear. Safari also has a keyboard shortcut for viewing the HTML source: Hold down the command and option keys and hit U (Cmd+Opt+U.) Advantages of Viewing Source CodeViewing the source to see how a web designer achieved a layout will help you learn and improve your work. Over the years, many web designers and developers have learned quite a lot of HTML by merely viewing the source of web pages they see. It's an excellent way for beginners to learn HTML and for seasoned web professionals to see how others used new techniques. Remember that source files can be very complicated. Along with the HTML markup for a page, there will probably be significant CSS and script files used to create that site's look and functionality, so don't get frustrated if you can't figure out what's going on immediately. Viewing the HTML source is just the first step. After that, you can use tools like Chris Pederick's Web Developer extension to look at the CSS and scripts as well as inspect specific elements of the HTML. Is Viewing Source Code Legal?While copying a site's code wholesale and passing it off as your own on a website is certainly not acceptable, using that code as a springboard to learn from is actually how many people make advancements in this industry. You would be hard-pressed to find a working web professional today who has not discovered something by viewing a site's source! Web professionals learn from each other and often improve upon the work that they see and are inspired by, so don't hesitate to view a site's source code and use it as a learning tool. FAQ
Thanks for letting us know! Get the Latest Tech News Delivered Every Day Subscribe A simple text editor is all you need to learn HTML. Learn HTML Using Notepad or TextEditWeb pages can be created and modified by using professional HTML editors. However, for learning HTML we recommend a simple text editor like Notepad (PC) or TextEdit (Mac). We believe that using a simple text editor is a good way to learn HTML. Follow the steps below to create your first web page with Notepad or TextEdit. Step 1: Open Notepad (PC)Windows 8 or later: Open the Start Screen (the window symbol at the bottom left on your screen). Type Notepad. Windows 7 or earlier: Open Start > Programs > Accessories > Notepad Step 1: Open TextEdit (Mac)Open Finder > Applications > TextEdit Also change some preferences to get the application to save files correctly. In Preferences > Format > choose "Plain Text" Then under "Open and Save", check the box that says "Display HTML files as HTML code instead of formatted text". Then open a new document to place the code. Step 2: Write Some HTMLWrite or copy the following HTML code into Notepad: <!DOCTYPE html> <h2>My First Heading</h2> <p>My first paragraph.</p> </body> Step 3: Save the HTML PageSave the file on your computer. Select File > Save as in the Notepad menu. Name the file "index.htm" and set the encoding to UTF-8 (which is the preferred encoding for HTML files). Tip: You can use either .htm or .html as file extension. There is no difference; it is up to you. Step 4: View the HTML Page in Your BrowserOpen the saved HTML file in your favorite browser (double click on the file, or right-click - and choose "Open with"). The result will look much like this: W3Schools Online Editor - "Try it Yourself"With our free online editor, you can edit the HTML code and view the result in your browser. It is the perfect tool when you want to test code fast. It also has color coding and the ability to save and share code with others: Example<!DOCTYPE html> <h2>This is a Heading</h2> </body> Try it Yourself » Click on the "Try it Yourself" button to see how it works. W3Schools SpacesIf you want to create your own website and save your code online, try our free website builder, called W3schools Spaces: |