Css selectors are based on the CSS rule, with selector we give styles to particular html elements. These selectors are defining in the form of id, class, type, attribute and more.
Selectors are not start with a number.
Elements Selectors select the style only html elements. A selector of p has selected the all p elements of the html documents. In the following example styles will apply only ul element not div element.
Html Comment Syntax:
<! - - Data are not display in the browsers -->
In Html the content is unheeded by any browser which we are placed in between comment tags.
Add comments into your html document to clarify your code, which may assist you after you, edit the source code at a later date. This is often particularly helpful if you’ve got lots of code and also when you debugging the html code.
<! – Contact form start here - ->
<div class=”contact-form”> form code </div>
<! –Contact form end here - ->
Now these days, Internet is part of life and it growing like crazy. Every person access the internet through desktop, laptops and mobiles. With the expansion in mobile net usage comes the question of the way to build websites appropriate for all users. Responsive design is an approach change the size of different elements on the website based on screen resolutions. In css2, a media query is used for printer friendly style sheets.
// Stylesheet for screen media
<link rel="stylesheet" type="text/css" href="stylesheet.css" media="screen" />
// Stylesheet for Print media
<link rel="print-screen" type="text/css" href="print.css" media="print" />
In HTML, not easy to understand which tags are block level or inline elements. Today we discussion about this, Html elements are only based on “block” and “inline” level elements.
You can give a style using HTML elements. For heading, italic, bold, underline, small, subscripts and so on. These elements are predefining in html.
Html formatting elements:
- Bold text
- Italic text
- Emphasized text
- Marked text
- Small text
- Deleted text
- Inserted text
Anything that seems among <b> </b> part, is displayed with bold as shown below:
<p>this text is<b> bold</b>.</p>
This text is bold.
Webpages are also making by tables. Tables are easy to learn and use, once you know about the basic table codes. Table are divided into <tr> (table rows) and td (table data) . Table row are also divided into table headings<th>. Default text alignment in the td tag is left and normal font weight. Border by default values is one, if you do not need border then change the value using border attribute border=”0”.
// Html tags for Table
<table style="width:100%" border=”0”>
Html list are define into three ways.
a) Unordered list
b) Ordered list
c) Description list
Html unordered list:
Unordered list tag is started from <ul>, and each list items are started from <li>. Unordered list means the lists haven’t special order or sequence. The unordered list default style is small black circles.
//Unordered list Example:
//Unordered list Attribute:
Without link webpages are incomplete, if we go from one page to another page on the webpage we need to create hyperlinks. You can create hyperlinks using anchor tag <a href=”url”> TEXT , Image </a>.
// Link tag
<a href="http://www.trickcollab.com/category/html/">Visit our HTML tutorial</a>
Visit our Html tutorial.
A stand for Anchor. It is a start tag and href attribute define in between.
Href stand for Hypertext Reference. It’s specifies the page address either relative (index.html) or absolute (http://www.trickcollab.com) path.
Html forms are important part of any website, without form you website is incomplete. If you collect any kind of information from the users you can collect it inform of name, email, country, phone number and visa card, etc. An Html form is made from one or more form elements. And those elements can be text input, textarea, select, email, buttons, radio button and checkbox button, etc. Some elements like Select and textarea are starting tags and closing tags (like <textarea></textarea>) and rest of the form elements are not closing tag (like <input>).
Form elements here.
In previous tutorials we discuss about html elements and tags. Some html elements have predefined attributes (like <a href=””></a>, <p title=””></p>) and a few not. Most of elements attributes are common in html4. An attribute is used to define the additional information about an element and is specified inside the element’s opening tag. All attributes are divided into two parts: a name and a value.