- HTML Tag
- Definition and Usage
- Browser Support
- Attributes
- Global Attributes
- Event Attributes
- Related Pages
- Default CSS Settings
- COLOR PICKER
- Report Error
- Thank You For Helping Us!
- : The Output element
- Attributes
- Examples
- Result
- Accessibility Concerns
- Technical summary
- Specifications
- Browser compatibility
- Found a content problem with this page?
- Html codes with output
- Learn Latest Tutorials
- Preparation
- Trending Technologies
- B.Tech / MCA
- Javatpoint Services
- Training For College Campus
- HTML Program Examples with Output [Writing Your First HTML Page]
- What is HTML?
- Different Types of Tags in HTML
- 1. Root element tag
- 2. Head element tag
- 3. Body element tag
- What is Empty HTML element?
- HTML Program Examples with Output using all the Basic Tags:
- Homepage Headline
- How to Execute an HTML Program File?
HTML Tag
Perform a calculation and show the result in an element:
Definition and Usage
The tag is used to represent the result of a calculation (like one performed by a script).
Browser Support
The numbers in the table specify the first browser version that fully supports the element.
Element | |||||
---|---|---|---|---|---|
10.0 | 13.0 | 4.0 | 5.1 | 11.0 |
Attributes
Attribute | Value | Description |
---|---|---|
for | element_id | Specifies the relationship between the result of the calculation, and the elements used in the calculation |
form | form_id | Specifies which form the output element belongs to |
name | name | Specifies a name for the output element |
Global Attributes
Event Attributes
Related Pages
Default CSS Settings
Most browsers will display the element with the following default values:
COLOR PICKER
Report Error
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
Thank You For Helping Us!
Your message has been sent to W3Schools.
Top Tutorials
Top References
Top Examples
Get Certified
W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.
: The Output element
The HTML element is a container element into which a site or app can inject the results of a calculation or the outcome of a user action.
Attributes
This element includes the global attributes.
A space-separated list of other elements’ id s, indicating that those elements contributed input values to (or otherwise affected) the calculation.
The element to associate the output with (its form owner). The value of this attribute must be the id of a in the same document. (If this attribute is not set, the is associated with its ancestor element, if any.)
This attribute lets you associate elements to s anywhere in the document, not just inside a . It can also override an ancestor element.
The element’s name. Used in the form.elements API.
The value, name, and contents are NOT submitted during form submission.
Examples
form oninput="result.value=parseInt(a.value)+parseInt(b.value)"> input type="range" id="b" name="b" value="50" /> + input type="number" id="a" name="a" value="10" /> = output name="result" for="a b">60output> form>
Result
Accessibility Concerns
Many browsers implement this element as an aria-live region. Assistive technology will thereby announce the results of UI interactions posted inside it without requiring that focus is switched away from the controls that produce those results.
Technical summary
Content categories | Flow content, phrasing content, listed, labelable, resettable form-associated element, palpable content. |
---|---|
Permitted content | Phrasing content. |
Tag omission | None, both the starting and ending tag are mandatory. |
Permitted parents | Any element that accepts phrasing content. |
Implicit ARIA role | status |
Permitted ARIA roles | Any |
DOM interface | HTMLOutputElement |
Specifications
Browser compatibility
BCD tables only load in the browser
Found a content problem with this page?
This page was last modified on Apr 13, 2023 by MDN contributors.
Your blueprint for a better internet.
Html codes with output
Learn Latest Tutorials
Preparation
Trending Technologies
B.Tech / MCA
Javatpoint Services
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
- Website Designing
- Website Development
- Java Development
- PHP Development
- WordPress
- Graphic Designing
- Logo
- Digital Marketing
- On Page and Off Page SEO
- PPC
- Content Development
- Corporate Training
- Classroom and Online Training
- Data Entry
Training For College Campus
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week
Like/Subscribe us for latest updates or newsletter
HTML Program Examples with Output [Writing Your First HTML Page]
This is the first tutorial on HTML programming. If you want to learn HTML, you are in the right place.
In this tutorial, you will learn all the basics you require to write and run your first HTML code. I will also explain different HTML program examples with output.
Table of Contents
What is HTML?
HyperText Markup Language is popularly known as HTML. It is the language that the web browser understands. Every web developer should learn this language and it is the basic language to start with.
Every web page you see on the internet is written in the HTML language. Even the page you are reading now uses HTML.
So now it might be clear to you, that running HTML code you don’t require installing any software. You can execute the HTML file in any of your internet browsers.
HTML is the common language that is understood by all web browsers today.
Different Types of Tags in HTML
In HTML, everything is written using tags and elements. It is a markup language that means it is used to mark the content in the web document.
An HTML document provides structural and semantic information of a webpage to the browser.
HTML contains a set of tags and elements that together form markup content. An element defines the purpose of a tag.
Start and end tags are used at the beginning and ending of an element.
For example:
The above is an example of the complete element from starting
tag, the content ‘This is a paragraph’ to the ending tag
.
1. Root element tag
The HTML element represents the root of any HTML document thus, is the root element. The root element is present in all the documents and codes. The root element always contains a and a element.
2. Head element tag
element is like a container that contains the information about the document and how it must be perceived by the browser or search engines.
It includes meta, titles, style, link, script, NoScript, and base. How to include these tags in the head? – we will see that in the latter part of the HTML tutorial.
element is one mandatory element within the element. This title is displayed as the page title in the browser tab and also the search engines identify the page with the help of this title. So, each HTML document should compulsorily have a tag.
3. Body element tag
All the content that is visible in a browser is contained within the element. Each HTML document has a element under which all the content is written using different tags.
There can be only one element in a document.
What is Empty HTML element?
You might have wondered seeing some of the HTML tags do not have an ending tag.
Empty elements are those elements that have no content and can be used without a closing tag.
An example of such an element is
that is a break tag, it defines a break between lines. Empty HTML elements can be closed within the opening tag such as
.
Except for the empty elements, the rest all the elements needs a closing tag.
HTML Program Examples with Output using all the Basic Tags:
A cumulative example of all the elements we have described above is below.
Homepage Headline
This is before the break tag
and this after the break tag.
Note: DOCTYPE is used to identify the type of document as an HTML file.
Don’t bother about the tags inside the body tag. I will tell you about these tags in the next tutorial in detail (link given below the post).
How to Execute an HTML Program File?
There are two ways you can do that.
- Create a new file with an extension .html in Notepad (Windows) or Vim (Linux) or any of the text editors. Copy the above code and save it in the file. Open the file in any of the internet browsers.
- Copy the above code and run it in the online HTML code editor.
By executing HTML code, you can visualize and understand each of the HTML basic tags, in a better way.
In this HTML program examples with output, we have learned about the basic HTML elements and their uses. HTML elements define the structure of the web pages and contain a number of HTML tags.
HTML is a very simple language. And it is widely used to write web pages. HTML was developed in various versions and HTML5 is the latest version.