Spread the word

Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts

Thursday, October 13, 2011

How to Color Alternate Rows in a Table with JavaScript and CSS

Tables should be used only when you are actually representing tabular data. Yes, we know that. But by default tables are not so much usable unless we put some addons and make tables usable. One of the best ways to make tabular data usable is to color alternate row backgrounds with different colors so that users don’t get lost while looking into long set of data. This not only helps users to remain on a specific track but also helps them interpret data precisely without generating much visual noise.

You can checkout the Demo of Alternate Table Row Coloring here.


Here is a very simple JavaScript script which can transform any existing tables on a page into tables with alternate row color backgrounds. This scripts check for specific class for a table on a page and puts different classes for different <tr>.
You can simply copy the following code and paste into the <head> section of your page.

Sunday, July 17, 2011

How to Create a Link To Smoothly Scroll To The Top of a Page by jQuery

"Go to top" is a very popular link that we use to put into web pages when pages tend to be long and users always need to go back to the top of the page to avail the options. Users can obviously go back by scrolling up and up and up. But we can also provide them with an option at the bottom of a page, clicking which will automatically take the user to the top of that page.

The most natural and effective way to do it is to place a "quick link" or "inpage link" which should be linked to the ID of the topmost element on the page.

Example of go to top link on a webpage:

Tuesday, March 22, 2011

How to Create Easy Collapsible and Expandable Lists in JavaScript

Here is a very quick and easy way to make your lists collapsible and expandable on clicks by using JavaScript. Now when presenting a long lists of item you can set them to remain collapsed on page load, but after that users can click and expand any of those list headings to see the full list of items. Unlike accordion, here users can easily open up all the lists one by one. Checkout the Demo of Collapsible and Expandable Lists which is created here.
First, just include a JavaScript file in your <header> section of the page -

<script src="http://www.acmeous.com/tutorials/demo/acmeousCollapsibleLists/acmeousCollapsibleLists.js" type="text/javascript"></script>
Then just below it, within the <header> section of your page, add the following code -

Friday, March 18, 2011

Differences Between Strict and Transitional DOCTYPEs

Attributes which are deprecated in Strict DOCTYPEs:

  • align (allowed on elements related to tables only, like - col, colgroup, tbody, td, tfoot, th, thead, and tr)

  • target

  • language

  • background

  • link

  • hspace

  • noshade

  • nowrap

  • bgcolor

  • text

  • vspace

  • vlink

  • alink

  • height (allowed on img and object)

  • border (allowed on table)

  • width (allowed on img, object, table, col, and colgroup)

  • name (allowed in HTML 4.01 Strict, not allowed on form and img in XHTML 1.0 Strict)

Wednesday, December 22, 2010

Difference Between XHTML and HTML4

HTML is the Hyper Text Markup Language which is rendered by any web browser you use to visit any website or web application. Whatever programming language, whatever platform a website or web application uses, it drills down to HTML only for your browser. So HTML is the building block of the World Wide Web which has not seen much significant improvement during last 2 decades except the Extensible Hyper Text Markup Language - the XHTML.

Here are the very basic differences between HTML and XHTML -

1) All documents must be well formed and properly nested

<p>The food is <em>delicious</em></p> - Correct.
<p>The food is <em>delicious</p></em> - Wrong.

2) Elements and Attributes must be in lowercase

Saturday, January 10, 2009

How to Validate Browser Specific CSS Hacks

Almost everyone who is a XHTML/CSS Developer knows Browser Specific CSS Hacks. If you don't know then you can know what Browser Specific CSS Hacks are from here. While creating tableless websites on CSS the biggest issue we face is consistency of the pages over various browsers i.e. cross-browser compatibility. So to make the websites and pages cross-browser compatibile many times we use several Browser Specific CSS Codes or Hacks. Though it is advices to avoid those Hacks since they are not by the standards, many times we are unable to do that.

Tuesday, December 16, 2008

What is Validation and why validation is important?

Validation is a process of checking webpages against Web Standards, mainly those which are published by the World Wide Web Consortium (W3C). Validation is done for HTML, XHTML, SMIL, MathML, CSS, RSS/ATOM Feeds, XML-derived Web document types, WapForum for WML, etc. Every language has its own grammar and syntax and so every document designed with these computer languages are expected to follow these guidelines and rules so that they are standard complaint. The markup languages of all versions use a specific declaration called Document Type Declaration (DTD) which is machine-readable grammar, inherited from SGML. When a webpage passes through this validation process then the page is called valid.

Thursday, October 30, 2008

How to add link and script codes in the Head tag from the body section through JavaScript

Many times we need to add <script> or <link> tags for some selected pages of a website. In many websites we use Content Management Systems or some templates where we can’t add different headers to different pages. But in many pages we need some extra functionality through scripts and other codes which are used differently in different pages within that site. Sometimes we need to insert the scripts within the page body tag which is not at all Web Standards compliant. The scripts and links to css or JavaScript files should always be in the head tag.

Monday, September 8, 2008

How to Design stylish variable width Web 2.0 Tabs Menu for your Web Applications

We use to see several types of navigation around different websites. Tabs are also one of the attractive navigation styles prevailing today. Thought they are stylish and useful to users, they never take up much of your real estate. But whenever you are creating tabs, you should not create fixed-width tabs. Then you will need to assign the maximum width to all items. That is space consuming and many times becomes ugly.
Stylish TabsHence you should design tabs which will take space as per the menu items. Here is how you can do it easily. You can create tabs just as in this image in few minutes. First you have to get the design as you want for your tabs. Now you need to slice them out to get these following pieces which will form your tab.
Here are two sets of tabs, one for inactive tabs and another for active tabs. You can have the third one to set on mouseover condition.

Monday, July 14, 2008

How to add noindex, nofollow in Blogroll for your Blogger/Blogspot Blogs

If you want to add a Blogroll in your Blogger Blog you can add it from your layout tab in your Blog's dashboard. You can add new page element and select the Blogroll element, where you specify the links you want to display on your Blog. You can choose the title of the section. Now if you want that Google don't share your Google Juice(PageRank value) to those sites, you can specify Google not to do that. For this you have to specify all those links to be non-recommended by adding a rel="nofollow" tag to those anchor tags.

Here is how you can do it by editing the html template of your Blog. Open the 'Edit HTML' tab in your Blogger Layout. Check the check box to Expand the widget templates. If your title for your Blogroll section is Blogroll, then find out for the following section in your template.

Wednesday, July 9, 2008

Simplest way to change images on Mouse Over through JavaScript

Many times we use to give some effects when users mouse overs an element. Sometimes we change the colors, sometimes we change sizes. Many times we also change the images on which users put their mouses on. Many times we use to change the texts in the images which is also done by changing the whole image on mouse over. Many times we see that images remain totally same on mouse over, just the color of the image is changed, which is also done by changing the whole image.

How to display html codes in your blog posts

Many times you need to show up HTML or JavaScript or PHP codes in your posts, but you don't want them to execute. You just trying to show your users how to write the code. Then you need a tip so that the codes don't get executed, but show up as it is as texts. You can do it easily through pre tags. Anything you insert within a pre tag, it is displayed as it is as texts and not executed. Here is an example of using pre tags to show html codes.

Saturday, July 5, 2008

Benefits of CSS based sites over Table based sites

There are lots of benefits in creating CSS based sites than table based sites. Always you may have heard the terms like tableless designs, CSS based sites etc. But if you have always thought that why you should leave your table based designs and take upon tableless designs, then here are the explanations to your thoughts. The key benefits to CSS based sites on tabled sites are:

Monday, June 30, 2008

How to create stylish text inputs for search, login or comment forms

You may have seen many stylish text inputs and designer forms in many websites. Just putting some text inputs and text areas and buttons, can't attract users to click there or type in some texts for you. If you wish your users grab those forms and fill out important information for you, you have to make those inputs in such a way that users get them accustomed with your site's theme. Users generally find no input forms to be interesting except it is a search box, which he/she have to use without any other option. But still f you make search inputs similar to your theme, it adds to your design and make it comfortable for your uses. After all designing is all about making elements soothing to users' eyes.



Here is a tutorial to make text inputs beautiful and matching to your website's theme. Suppose you have a login input in a bar, where users enter their passwords. Here is a sample how the input has been matched with the bar.




Here I have created a stylish input matching with the dark red colored background bar. Now lets see how you can implement it.



At first just insert normal form and input elements in your page like this.



Login:



View the source to get see the code.
This has inserted a form and a text input in your page. Notice that I have put an id="passText" in the input element. This will help you to stylize it through CSS. Now here is the CSS part.

#loginForm [
background: url(images/passText.jpg) no-repeat;
/* where passText.jpg is the stylish box image */
height: 20px;
width: 100px;
font-weight: normal;
color: #ffffff;
border: 0px;
}

#passText {
width: 80px;
height: 18px;
margin-left: 18px;
background: transparent;
color: #ffffff;
}


Now this will transform your input box just as you wished and seen in the picture. The form has the image for the text input in its background, and the input text's background is transparent. The size of the input text is made smaller than the form, so that the texts typed inside the input don't come out of the designed box.


This is the basis of form designing and in this pattern you can make your forms look beautiful and totally matching your site's theme, which adds beauty to your site. Now make designer forms and inputs and attract users to use them more and more.


Wednesday, May 14, 2008

How to Center Align a Website or Html Element Without Align Tag

To position a website or a div tag or p tag in the center of the screen from Internet Explorer 4 and up including all modern browsers like Firefox, Opera, Netscape etc, we often use the align="center". Though this tag satisfies our aim and centers the element in the screen, but this tag is not recognized by W3 Validator as a valid XHTML content. Thats why if you are cautious enough about your website to be XHTML Validated, you can’t use it .