HTML code viewer is a web design tool. If you don’t know how to view a web page’s source code, this source code viewer will let you examine the source code of any web page. If you’re a student and learning how to code HTML, this is the best HTML code viewer tool to extract the HTML source of a webpage. In short, you can also call this. Always use a language attribute on the html tag to declare the default language of the text in the page. When the page contains content in another language, add a language attribute to an element surrounding that content. Use the lang attribute for pages served as HTML, and the xml:lang attribute for pages served as XML. For XHTML 1.x and HTML5.
IntelliJ IDEA brings powerful support for HTML that includes syntax and error highlighting, formatting according to the code style, structure validation, code completion, on-the-fly preview during a debugging session (Live Edit), and much more.
HTML specification is configurable with the Default HTML language level preference on the Languages and Frameworks | Schemas and DTDs page of the Settings/PreferencesCtrl+Alt+S. By default, specification HTML 5.0 from W3C is assumed.
Creating an HTML file
- From the main menu, select File | New, and then select HTML File from the list. IntelliJ IDEA creates a stub file based on the HTML file template and opens it in the editor.
Creating references in an HTML file
Inside a
<script>
, <link>
, or <img>
tag, IntelliJ IDEA suggests completion for the path to the file you are referencing. - Open development of select macOS projects Tools and Technologies. Why you'll love to develop on your Mac Open Source in macOS. Learn about the 200+ open source projects that ship with macOS Darwin Technologies. Beneath the easy-to-use interface of macOS is a rock-solid, UNIX foundation.
- Formatting short quotations with the element. Formatting quoted sections with the element. Formatting document author/owner information with the element Formatting abbreviations and acronyms the element Formatting work title with the element Formatting text direction with the element.
Alternatively, in the Project tool window, select the JavaScript, CSS, or image file you want to reference and drag it into the HTML file. IntelliJ IDEA generates the
<script>
, <link>
, or <img>
tags inside <head>
. For <img>
tags, IntelliJ IDEA also generates the width
and height
attributes. Wrapping a code fragment in a tag
- Select the code fragment to wrap and press Ctrl+Alt+T or select Code | Surround With from the main menu.
- From the list, select Wrap with Tag. IntelliJ IDEA encloses the selection in a pair of brackets (
<>
and</>
). - Type the tag inside the opening brackets
<>
. IntelliJ IDEA automatically fills in the tag in the closing brackets</>
.
![Html web code example Html web code example](/uploads/1/2/6/4/126465172/266719881.png)
Learn more from Generate code.
Web Pages In Html
Documentation look-up
For most HTML tags and attributes IntelliJ IDEA can show you a summary from the corresponding MDN article. This summary is displayed in the Documentation popup which also shows the deprecation status of a tag or an attribute and information on its compatibility with various browsers.
If the tag or the attribute is available in all versions of browsers, IntelliJ IDEA does not show any information about its compatibility.
Otherwise, the Documentation popup also lists the browsers and their versions that support the tag or the attribute.
Compatibility is checked only for Chrome, Chrome Android, Safari, Safari iOS, Firefox, Internet Explorer, and Edge.
If the tag or the attribute is deprecated, the popup also informs you about this status.
View documentation for a tag or an attribute
- Position the caret at the tag or the attribute and press Ctrl+Q or select View | Quick Documentation Lookup from the main menu.
- When you hover the mouse pointer over a tag or an attribute, IntelliJ IDEA immediately displays the reference for it in the Documentation popup.You can turn off this behavior or configure the popup to appear faster or slower, see Configuring the behavior of Documentation popup below.
Configure the behavior of Documentation popup
- To turn off showing documentation automatically, open the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | Code Editing, and clear the Show quick documentation on mouse move checkbox.
- To have the Documentation popup shown faster or slower, open the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | General | Code Completion, then select the Show the documentation popup checkbox and specify the delay time.
Open the MDN documentation for tags and attributes in the browser
- In the Documentation popup Ctrl+Q, click the link at the bottom.
- Press Shift+F1 or select View | External Documentation from the main menu.
Previewing output of an HTML file in a browser
To preview PHP pages in the browser, you need to create at least one deployment configuration and mark it as default.
- Select View | Open in Browser from the main menu and then select the desired browser from the list. To open the IntelliJ IDEA default browser, select Default.
- Alternatively, hover your mouse pointer over the code to show the browser icons popup, and click the icon that indicates the desired browser:To hide all the icons or some of them, clear the Active checkboxes for the unnecessary browsers on the Web Browsers page.To suppress showing the browser icons popup, clear the For HTML files checkbox.
- If you have only one browser configured, just press Alt+F2.
Viewing HTML source code of a web page in the editor
- Press Ctrl+Shift+A and select Open Source Code from URL... from the list.
- In the Open URL dialog that opens, type the URL address of the web page or choose a previously opened URL from the list.
Viewing embedded images
IntelliJ IDEA offers several ways to view images embedded in an HTML file. You can use navigation to source, open an image in an external graphical editor, or preview images on-the-fly.
Check and configure the appearance of the preview on the Images page.
View images in IntelliJ IDEA
- Select the image file in the Project tool window and press F4.
- Alternatively, position the caret at the reference to the image in the editor and press Ctrl+B
- To preview an image in a popup instead of in a separate tab, select the reference to it and press Ctrl+Shift+I
View images in an external editor
- Configure the path to the external editor on the Images page (File | Settings | Editor | Images for Windows and Linux or IntelliJ IDEA | Preferences | Editor | Images for macOS).
- Select the image file in the Project tool window, and choose Open in external editor or press Ctrl+Alt+F4.
Extracting an include file
You can extract a fragment of HTML code into a separate include file. Entire JavaScript code blocks inside a
<script>
tags can be extracted as well. IntelliJ IDEA also suggests adding references instead of duplicates of the selected fragment. ![Google web page Google web page](/uploads/1/2/6/4/126465172/857601705.jpg)
- In the editor, select the code block to be extracted and choose Refactor | Extract | Extract Include File from the main menu or from the context menu of the selection.
- In the Extract Include File dialog that opens, specify the name of the include file without the extension and the directory to store it in. You can accept the predefined directory or select another one.
- Click OK, when ready. IntelliJ IDEA extracts the selected source code into the specified file in the target directory and generates the corresponding reference in the source file.
Configuring syntax highlighting
You can configure HTML-aware syntax highlighting according to your preferences and habits.
- In the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | Color Scheme | HTML.
- Select the color scheme, accept the highlighting settings inherited from defaults or customize them as described in Configuring Colors and Fonts.
Web browsers let you view the HTML and CSS source code of a web page. Sneaking a peek at the source code of a web page is a great way to see how it’s built — and to see how you can do something similar.
To see the HTML code behind a web page, follow these simple steps:
- Go online and open a web browser, such as Mozilla Firefox or Internet Explorer.
- Go to any website by typing the URL of any web page whose HTML source code you’d like to see.
- Look at the HTML source of the page:
- In Firefox, choose View→Page Source from the menu bar.
- In Internet Explorer, choose View→Source.
You’ll see a new window with the HTML code for the current page you are viewing. If you glance through the code, you’ll see the text content of the page and all the <a> tags for each link. You can select and copy the whole page or any portion of it.
The source window shows you just the HTML code, not any externally linked CSS documents (see the following figure). If the page uses CSS, the <head> section at the top of the HTML code will contain the URL path to the CSS file. You can copy the path and paste that into your browser’s location field, like typing in a web address, and see the CSS code that the page uses.
In the example, the CSS link is written as a relative path — relative to the path already in the web browser. To complete the path you need to append /unassets/css/smart_min.css to the URL that shows in the address bar at the top of the screen.
When you finish adding the relative path to the URL, you press or click Enter to access the CSS; if you’re running Windows, the CSS shows up in a Notepad file that opens automatically onscreen, as in the following figure.
By copying and pasting the CSS URL path in a browser window, you can view a page’s CSS source file.