Showing posts with label Html. Show all posts
Showing posts with label Html. Show all posts

Pseudo-Elements In CSS



A pseudo-element creates a phoney element and inserts it before or after the content of the element that you've targeted. They don't actually change anything in the document. Rather, they insert ghost-like elements that are visible to the user and that are style-able in the CSS.

To learn about the cool things you can do with pseudo-elements click here.

Read more


Under Construction Template for websites

At some point of time every website is in a phase of construction or maintenance  and it leaves a bad impression on users if its shows a blank page or gives a 404 error. So, whenever your site is being revamped you need to tell yours users that your website is under construction.

Below are some of the templates you can use for showing that your site is under construction and telling them to visit again later.












Read more


Display Html Tags

We can’t display html tags as it is to get displayed in the browser. Say for example you want to give html code to your visitor to place a link in their web site, pointing to your site. To display html tags in html format we have to use different ways. Browser will not display any thing within less than and greater than symbols. Browser will not display < character as it is. To display symbol < we have to write &lt; , same way to display greater than character > we have to use &gt; . Use the following for displaying the symbols.


<
>
&

"
®
©
&lt;
&gt;
&amp;
&nbsp;
&quot;
&reg;
&copy;
less than
greater than
ampersand
non breaking space
double quote
registered trade mark
copyright

To display the following html code on the browser use the code given below.

Preview
<!DOCTYPE html PUBLIC "-//W3C//DTD html 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
</style>

<script type="text/javascript">
</script>

</head>
<body>

<div></div>

</body>
</html>


Code
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD html 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;

&lt;style type="text/css"&gt;
&lt;/style&gt;

&lt;script type="text/javascript"&gt;
&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;div&gt;&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;

Read more


Count Number of Words and Characters in Textbox


This post contains the javascript code for counting the number of words and character
contained in a text box.

Demo




Javascript Code
function CountWords (this_field, show_word_count, show_char_count) {

if (show_word_count == null) {
show_word_count = true;
}

if (show_char_count == null) {
show_char_count = false;
}

var char_count = this_field.value.length;
var fullStr = this_field.value + " ";
var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
var splitString = cleanedStr.split(" ");
var word_count = splitString.length -1;


if (fullStr.length <2) {
word_count = 0;
}
if (word_count == 1) {
wordOrWords = " word";
}
else {
wordOrWords = " words";
}
if (char_count == 1) {
charOrChars = " character";
} else {
charOrChars = " characters";
}
if (show_word_count & show_char_count) {
alert ("Word Count:\n" + "    " + word_count + wordOrWords + "\n" + "    " + char_count + charOrChars);
}
else {
if (show_word_count) {
alert ("Word Count:  " + word_count + wordOrWords);
}
else {
if (show_char_count) {
alert ("Character Count:  " + char_count + charOrChars);
      }
   }
}
return word_count;
}


Html Code


<form>
<textarea cols="40" name="x" rows="5"> </textarea>
<input type=button value="Count" OnClick ="CountWords(this.form.x, true, true);">
</form>

Read more

About This Blog

This is a place where I write about the things I find interesting and are worth to share.