cover-img

What is syntax, html syntax, html element - Full stack development - Blog 1

12 May, 2022

14

14

0

What is a syntax?
  • syntax simply means rules. why rules are applied in programming languages? before that, we have to ask, generally why rules are applied in our daily life.
  •  lets take an example, a basic rule in the road is to follow the traffic rules. its your wish, you can follow the traffic rules or not. But what will happen if you don't follow. You know, accident will happen. so what is the consequence, of not following the rule? some problem will arise. that is it.
  • coming back to point - syntax are rules. so what will happen in computer programming, if we don't follow the rules. The problem which will happen is, the computer cannot understand what you are saying. 
  • So that only syntax (a set of rules) made to make you enter code in a proper way, so computer can understand it easily. 
Is syntax followed by html?
  • syntax is followed by every language, so html also follows it.
what is an element, how is syntax used in html?
  • basically, html is a language which has a series of elements.
  • so what are elements 
  • elements is a collection of open tag, tag name, content, close tag. let us see with examples. 
                    <h1>My First Heading</h1>  
                    <p>My first paragraph.</p>
  • What are open tags and close tags? in this example open tag is < > and close tag is </ > 
  • What is a tag name? tag name is nothing but the thing, which present inside the < > and </ >. Both open tag and close tag will have same tag name. h1 and p are tag names in two examples.
  •  then what is content? content is the thing which is present inbetween the open tag and the close tag. "My First Heading" and "My first paragraph" is the content in the two examples. simply we cannot say, the content is the thing which is present inside the open tag and close tag. so what is content, in the web development.
  • content is the thing, which will be printed in the webpage. for example we have to write a paragraph in a webpage. how it can be done. we have to start with open tag and close with close tag and the paragraph which we have to display in the webpage, has to be written in between the open and close tags. from examples, we can say "My First Heading" and "My first paragraph" will be printed on the webpage.
  • Ok fine. so what is the role of the tag name? tag name is the thing which has to decide how the content has to be printed.
  • for example, we may need to insert some text as a heading in the webpage. some as a sub heading and some text as a paragraph and some text as a bulleted. so how to do that. That is where the tag name comes into play. tag name decides whether the text you type, will be printed as a paragraph or a heading or a sub heading or a bulleted list. let us see the example.
            <h1>My First Heading</h1>  
            <p>My first paragraph.</p>
  • in the first code, we have open tag and close tag. the tag name which we have given is h1. h1 simply means a heading. 'h' stands for heading. Then you may ask, what is that "1". now simply understand h stands for heading. upcoming blogs we can understand what is that "1".
  • h stands for heading. that is ok. but what does it mean. it means that, when the tag name is given as h1, the content that we write between the open tag and close tag will be considered and printed as a heading in a webpage. so from first example, "My First Heading" will be printed as the heading.
  • likewise, the second example has p as tag name. p stands for paragraph. so whatever content we write inbetween the tags, which has tag name p, html will print it as a paragraph in the webpage.
  • for writing a paragraph, we use <h1>My First Heading</h1> element. like this html code has a series of element for different purposes. 
  • then what is the syntax in html?. syntax is nothing but, we have to properly insert open tag, close tag, tag name etc. if we violate this, it violates the syntax.
  • Finally just recall yourself, whether you have understood, what is a syntax, element, open tag, close tag, tag name, content etc. 
  • let us see in the next blog. Thank you for learning.
Below is my website link to read all my blogs. Thank you Friends.

14

14

0

Bharath Arun
passionate to learn

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2024. Showcase Creators Inc. All rights reserved.