Level no.16




 Lecture no.16

How to create space in html?
 We cannot do spacing in HTML by space-bar,by default it counts only one. So we use  "&nbps;" entity in HTML for spacing. It stands for non breaking space in HTML for spacing.

How to set width of text box in form tag?

You can use width attribute with type element or apply style tag with width attribute.

Syntax
Name: <input type="text" width="20px;">

with style tag.

<style width="200px">
Name: <input type="text">
</style>
How to set length of text ?
For setting length we use minlenght and maxlenght attribute in form tag. We cannot use this limit for number attribute in form tag.
Syntax
For writing address we set the limit of the words that they cannot exceed more than 50 words.
Address: <input type="text" minlenght="10" maxlenght="50">.

Required and Readonly Attribute
Required Attribute
The required attribute is used to mark a form element as required. which means that user must provide a value for that element before they submit a form. if your tries to fill form without filling the required field they will receive an error message to complete this field.

Syntax 
Name: <input type="text">
Age: <input type="number" required>

In this it is compulsory for user to fill age field if they not provide data at age field surely get an error message.

Readonly Attribute
It is used to make form un-editable. It means that user can see the element not providing any text or number.It is used where user id not allowed to change information or provide any type of information.

Syntax 
Name: <input type="text">
Age: <input type="number" >
Address: <input type="text" id="balance" value="$23000" readonly>

User cannot change information in address element. They can only read that information.

How to write by default message in html?
By creating by default message in html the placeholder attribute is used. This can be used with any type of attribute because it can only print default message.

Syntax
Email: <input type=email" placeholder="xyz@gmail.com">
This is how you can write default message in html.

Fieldset and Legend  Tag
Fieldset tag is to make a group of related elements in the form, and it creates the box over the elements. It is used to define the title for the child content and the legend tag is used for parent content. Fieldset is used to group related element together. Legend tag is provide the title or description for the grouping element

Syntax
<fieldset>
<legend> </legend>
</fieldset>
Code
<fieldset>
<legend>contact info. </legend>
Name: <input type="text">
Age: <input type="number" >
email: <input type="email">
</fieldset> <br> <br> 

<fieldset>
<legend>educational  info. </legend>
School grade: <input type="text">
passing year <input type="number" >
College grade: <input type="text">
passing year <input type="number" >
email: <input type="email">
</fieldset> <br> <br> 

How to change color in fieldset tag?

To change color in fieldset tag the background-color with style  attribute is used.
Syntax
<fieldset style=" background-color= red"> 

</fieldset   style=" background-color= blue">

Comments

Popular posts from this blog

Level no.4

Level no.21

Level no.3