HTML
HTML
How to create rounded border for DIV, PRE like HTML elements
Dec 1st
The following CSS code enables rounded borders for elements like DIV, PRE etc. However it may not work in Internet Explorer (IE) as it is specific to certain browsers like Firefox.
pre {
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
The above CSS defines 3px radius for the rounded element. You can change it to a value of your choice.
How to define scrollable and fixed width DIV or PRE tag in HTML using CSS
Nov 30th
With fixed width websites, it is often desired to fix the maximum width of certain elements like <DIV>, <PRE> etc. However by fixing the maximum width of these elements, the content inside them may either disappear or may interfere with the content of element that appear near to them.
CSS supports an attribute “overflow” which can be used to define the way how browser should behave if the contents of such element tend to go beyond width or height of the element. The following are the possible values for “overflow” attribute.
Value Meaning auto Display horizontal or vertical scroll bar automatically when More >How to change bullet style for unordered list UL in HTML or CSS
Nov 30th
The unordered list “<ul>” supports an attribute named “type” that specifies type of display for bullets. The “type” attribute takes values: disc,circle,square.
The following displays a square instead of default disc style for bullets.
<ul type="square"> <li>One</li> <li>Two</li> <li>Three</li> </ul>
display looks like following
- One
- Two
- Three
Similarly, a disc style appears as follows:
- One
- Two
- Three
Similarly, a circle style appears as follows:
- One
- Two
- Three
Otherwise, you can use “list-style-type” attribute in CSS as shown below:
ul {
list-style-type: square;
}
You can customize the bullets further by specifying an image url in CSS as follows:
ul {
list-style-type: url("/images/arrow.jpg");
}
More >
How to display special characters in HTML
Nov 30th
HTML is a mark up language that uses characters like “<”, “>” as part of its syntax. So it provides a special escapes to display the special characters as is in HTML. The following table provides list of special characters and their HTML syntax.
Name Symbol HTML syntax Ampersand & & Cent ¢ ¢ Copyright © © Degree ° ° Greater Than > > Less Than < < Non-breaking Space Registered Trademark ® ® Trademark ™ ™
How to disable left indentation of LI tags in HTML
Nov 29th
The <li> tag can be used under an unordered list tag <ul> or ordered list tag <ol>.
The following shows how <li> tag can be used in an unordered list. Under unordered list, each <li> shows a bullet by default.
<ul> <li>One</li> <li>Two</li> <li>Three</li> </ul>
The above code appears in the browser as follows:
- One
- Two
- Three
You can use following CSS to disable left indentation:
ul {margin: 0;}
If you don’t want to display bullets, you can do the following.
ul {
list-style-type: none;
margin: 0;
}
You can use similar trick for ordered list
- as well.
More >
How to disable display of bullets for LI tags in HTML
Nov 29th
The <li> tag can be used under an unordered list tag <ul> or ordered list tag <ol>.
Unordered List The following shows how <li> tag can be used in an unordered list. Under unordered list, each <li> shows a bullet by default.
<ul> <li>One</li> <li>Two</li> <li>Three</li> </ul>
The above code appears in the browser as follows:
- One
- Two
- Three
If you don’t want each <li> item not to display its position as number under <ul>, you can add “list-style-type: none;” style to the <ul> tag.
<ul style="list-style-type: none;"> <li>One</li> <li>Two</li> <li>Three</li> </ul>
Ordered List The following shows how <li> tag can be used in an ordered list. Under ordered list, each More >
How to define local links in a web page
Aug 18th
The local links in a web page are called anchors.
To define an anchor in a HTML page, create a dummy “a” link as shown below.
<a id="chapter1"></a>
Create a link that user can click on to go to the previously defined anchor.
<a href="#chapter1">Chapter1</a>
How to force a HTML link to open in a new TAB
Mar 4th
Typically it is good to open a link which takes the user out of current website in a new window or a new TAB so that the user doesn’t leave the original site.
The link target can be specified as “_blank” to force the link to open in a new TAB. The following example shows how to do it.
<a href="http://www.popularmatrimony.com" target="_blank">PopularMatrimony</a>
The following example link shows how it works. PopularMatrimony


Recent Comments