Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

Solve : Guide to Search Engine Optimisation?

Answer» Introduction

Search Engine Optimisation (SEO) is often considered the more technical part of Web marketing. This is true because SEO does help in the promotion of sites and at the same time it requires some technical knowledge – at least familiarity with basic HTML. SEO is sometimes also called SEO copyrighting because most of the techniques that are used to promote sites in search engines deal with text. Generally, SEO can be defined as the activity of optimizing Web pages or whole sites in order to make them more search engine-friendly, thus getting higher positions in search results.

One of the basic truths in SEO is that even if you do all the things that are necessary to do, this does not automatically guarantee you top ratings but if you neglect basic rules, this certainly will not go unnoticed. Also, if you set realistic goals – i.e to get into the top 30 results in Google for a particular KEYWORD, rather than be the number one for 10 keywords in 5 search engines, you will feel happier and more satisfied with your results.

Although SEO helps to increase the traffic to one's site, SEO is not advertising. Of course, you can be INCLUDED in paid search results for given keywords but basically the idea behind the SEO techniques is to get top placement because your site is relevant to a particular search term, not because you pay.

SEO can be a 30-minute job or a permanent activity. Sometimes it is enough to do some generic SEO in order to get high in search engines – for instance, if you are a leader for rare keywords, then you do not have a lot to do in order to get decent placement. But in most cases, if you really want to be at the top, you need to pay special attention to SEO and devote significant amounts of time and effort to it. Even if you plan to do some basic SEO, it is essential that you understand how search engines work and which items are most important in SEO.


1. How Search Engines Work

The first basic truth you need to learn about SEO is that search engines are not humans. While this might be obvious for everybody, the differences between how humans and search engines view web pages aren't. Unlike humans, search engines are text-driven. Although technology advances rapidly, search engines are far from intelligent creatures that can feel the beauty of a cool design or enjoy the sounds and movement in movies. Instead, search engines crawl the Web, looking at particular site items (mainly text) to get an idea what a site is about. This brief explanation is not the most precise because as we will see next, search engines perform several activities in order to deliver search results – crawling, indexing, processing, calculating relevancy, and retrieving.

First, search engines crawl the Web to see what is there. This task is performed by e piece of software, called a crawler or a spider (or Googlebot, as is the case with Google). Spiders follow links from one page to another and index everything they find on their way. Having in mind the number of pages on the Web (over 20 billion), it is impossible for a spider to visit a site daily just to see if a new page has appeared or if an existing page has been modified. Sometimes crawlers will not visit your site for a month or two, so during this time your SEO efforts will not be rewarded. But there is nothing you can do about it, so just keep quiet.

What you can do is to check what a crawler sees from your site. As already mentioned, crawlers are not humans and they do not see images, Flash movies, JavaScript, frames, password-protected pages and directories - they won't be viewable by the spider. If they are not viewable, they will not be spidered, not indexed, not processed, etc. - in a word they will be non-existent for search engines.

After a page is crawled, the next step is to index its content. The indexed page is stored in a giant database, from where it can later be retrieved. Essentially, the process of indexing is identifying the words and expressions that best describe the page and assigning the page to particular keywords. For a human it will not be possible to process such amounts of information but generally search engines deal just fine with this task. Sometimes they might not get the meaning of a page right but if you help them by optimizing it, it will be easier for them to classify your pages correctly and for you – to get higher rankings.

When a search request comes, the search engine processes it – i.e. it compares the search string in the search request with the indexed pages in the database. Since it is likely that more than one pages (practically it is millions of pages) contains the search string, the search engine starts calculating the relevancy of each of the pages in its index to the search string.

There are various algorithms to calculate relevancy. Each of these algorithms has different relative weights for common factors like keyword density, links, or metatags. That is why different search engines give different search results pages for the same search string. What is more, it is a known fact that all major search engines, like Yahoo!, Google, MSN, etc. periodically change their algorithms and if you want to keep at the top, you also need to ADAPT your pages to the latest changes. This is one reason (the other is your competitors) to devote permanent efforts to SEO, if you'd like to be at the top.

The last step in search engines' activity is retrieving the results. Basically, it is nothing more than simply displaying them in the browser – i.e. the endless pages of search results that are sorted from the most relevant to the least relevant sites.


2. Differences Between the Major Search Engines

Although the basic principle of operation of all search engines is the same, the minor differences between them lead to major changes in results relevancy. For different search engines different factors are important. There were times, when SEO experts joked that the algorithms of Yahoo! are intentionally made just the opposite of those of Google. While this might have a grain of truth, it is a matter a fact that the major search engines like different stuff and if you plan to conquer more than one of them, you need to optimize carefully.

There are many examples of the differences between search engines. For instance, for Yahoo! and MSN, on-page keyword factors are of primary importance, while for Google links are very, very important. Also, for Google sites are like wine – the older, the better, while Yahoo! generally has no expressed preference towards sites and domains with tradition (i.e. older ones). Thus you might need more time till your site gets mature to be admitted to the top in Google, than in Yahoo!. Keywords – the Most Important Item in SEO

Keywords are the most important SEO item for every search engine – actually they are what search strings are matched against. So you see that it is very important that you optimise your site for the right keywords. This seems easy at first but when you get into more detail, it might be a bit confusing to correctly determine the keywords. But with a little research and thinking the problem of selecting the right keywords to optimise for can be solved.


1. Choosing the Right Keywords to Optimise For

It seems that the time when you could easily top the results for a one-word search string is centuries ago. Now, when the web is so densely populated with sites, it is next to impossible to achieve constant top ratings for a one-word search string. Achieving constant top ratings for two-word or three-word search strings is a more realistic goal. If you examine closely the dynamics of search results for popular one-word keywords, you might notice that it is so easy one week to be in the first ten results and the next one– to have fallen out of the first 30 results because the competition for popular one-word keywords is so fierce and other sites have replaced you.

Of course, you can include one-word strings in your keywords list but if they are not backed up by more expressions, do not dream of high ratings. For instance, if you have a site about dogs, “dog” is a mandatory keyword but if you do not optimise for more words, like “dog owners”, “dog breeds”, “dog food”, or even “canine”, success is unlikely, especially for such a popular keyword. The examples given here are by no means the ultimate truth about how to optimise a dog site but they are good enough to show that you need to think broad when choosing the keywords.

Generally, when you start optimization, the first thing you need to consider is the keywords that describe the content of your site best and that are most likely to be used by users to find you. Ideally, you know your users well and can guess correctly what search strings they are likely to use to search for you. One issue to consider is synonyms. Very often users will use a different word for the same thing. For instance, in the example with the dog site, “canine” is a synonym and it is for sure that there will be users who will use it, so it does not hurt to include it now and then on your pages. But do not rush to optimise for every synonym you can think of – search engines themselves have algorithms that include synonyms in the keyword match, especially for languages like English.

Instead, think of more keywords that are likely to be used to describe your site. Thinking thematically is especially good, because search engines tend to rate a page higher if it belongs to a site, the theme of which fits into the keyword string. In this aspect it is important that your site is concentrated around a particular theme – i.e. dogs. It might be difficult to think of all the relevant keywords on your own but that is what tools are for. You can try Google's Keyword Tool to get more suggestions about which keywords are hot and which are not.

When choosing the keywords to optimise for, you need to consider not only their relevancy to your site and the expected monthly number of searches for these particular keywords. Very often narrow searches are more valuable because the users that come to your site are those that are really interested in your product. If we go on with the dog example, you might discover that the “adopt a dog” keyphrase brings you more visitors because you have a special section on your site where you give advice on what to look for when adopting a dog. This page is not of interest to current dog owners but to potential dog owners only, who might be not so many in number but are your target audience and the overall effect of attracting this niche can be better than attracting everybody who is interested in dogs in general. So, when you look at the numbers of search hits per month, consider the unique hits that fit into the theme of your site.


2. Keyword Density

After you have chosen the keywords that describe your site and are supposedly of interest to your users, the next step is to make your site keyword-rich and to have good keyword density for your target keywords. Keyword density is a common measure of how relevant a page is. Generally, the idea is that the higher the keyword density, the more relevant to the search string a page is. The recommended density is 3-7% for the major 2 or 3 keywords and 1-2% for minor keywords.

Although there are no strict rules, try optimizing for a reasonable number of keywords – 5 or 10 is Okay. If you attempt to optimise for a list of 300, you will soon see that it is just not possible to have a good keyword density for more than a few keywords, without making the text sound artificial and stuffed with keywords. And what is worse, there are severe penalties (including ban from the search engine) for keyword stuffing because this is considered an unethical practice that tries to manipulate search results.


3. Keywords in Special Places

Keywords are very important, not only as quantity, but as quality as well – i.e. if you have more keywords in the page title, the headings, the first paragraphs – this counts more that if you have many keywords at the bottom of the page. The reason is that the URL (and especially the domain name), file names and directory names, the page title, the headings for the separate sections are more important than ordinary text on the page and therefore, all equal, if you have the same keyword density as your competitors but you have keywords in the URL, this will boost your ranking incredibly, especially with Yahoo!.


a. Keywords in URLs and File Names

The domain name and the whole URL of a site TELL a lot about it. The presumption is that if your site is about dogs, you will have “dog”, “dogs”, or “puppy” as part of your domain name. For instance, if your site is mainly about adopting dogs, it is much better to name your dog site “dog-adopt.net” than “animal-care.org”, for example, because in the first case you have two major keywords in the URL, while in the second one you have no more than one potential minor keyword.

When hunting for keyword rich domain names, don't get greedy. While from an SEO point of view it is better to have 5 keywords in the URL, just imagine how long and difficult to memorize the URL will be. So you need to strike a balance between the keywords in the URL and site usability, which says that more than 3 words in the URL is way too much. Even if you manage to think of a couple of good domain names, they might be already taken.

File names and directory names are also important. Often search engines will give preference to pages that have a keyword in the file name. For instance http://mydomain.com/dog-adopt.html is not as good as http://dog-adopt.net/dog-adopt.html but is certainly better than http://mydomain.com/animal-care.html. The advantage of keywords in file names over keywords in URLs is that they are easier to change, if you decide to move to another niche, for example.


b. Keywords in Page Titles

The page title is another special place because the contents of the <title> tag usually gets displayed in most search engines, (including Google). While it is not mandatory per the HTML specification to write something in the <title> tag (i.e. you can leave it empty and the title bar of the browser will read “Untitled Document” or similar), for SEO purposes you may not want to leave the <title> tag empty; instead, you'd better write the the page title in it.

Unlike URLs, with page titles you can get wordy. If we go on with the dog example, the tag of the home page for the http://dog-adopt.net can include something like this: <title>Adopt a Dog – Save a Life and Bring Joy to Your Home</title>, <title>Everything You Need to Know About Adopting a Dog</title>, or even longer.


c. Keywords in Headings

Normally headings separate paragraphs into related subtopics and from a literary point of view, it may be pointless to have a heading after every other PARAGRAPH but from an SEO point of view, it is extremely good to have as many headings on a page as possible, especially if they have the keywords in them.

There are no technical length limits for the contents of the <h1>, <h2>, <h3>, ... <h#> tags but common sense says that too long headings are bad for page readability. So, like with URLs, you need to be wise with the length of headings. Another issue you need to consider is how the heading will be displayed. If it is Heading 1 (<h1>), generally this means larger font size and in this case it is recommendable to have less than 7-8 words in the heading, otherwise it might spread on 2 or 3 lines, which is not good and if you can avoid it – do it. Meta Tags

A couple of years ago, <meta> tags were the primary tool for search engine optimisation and there was a direct correlation between what you wrote there and your position in search results. However, algorithms got better and today the importance of metadata is decreasing day by day, especially with Google. But still some search engines show metadata (under the clickable link in search results), so users can read what you have written and if they think it is relevant, they might go to your site. Also, some of the specialised search engines still use the metatags when ranking your site.

The meta description tag is one way for you to write a description of your site, thus pointing search engines to what themes and topics your web site is relevant to. It does not hurt to include at least a brief description, so don't skip it. For instance, for the dog adoption site, the meta description tag could be something like this: <meta name=“description” content=“Adopting a dog saves a life and brings joy to your house. All you need to know when you consider adopting a dog.” />

A potential use of the meta keywords tag is to include a list of keywords that you think are relevant to your pages. The major search engines will not take this into account but still it is a chance for you to emphasize your target keywords. You may consider including alternative spellings (or even common misspellings of your keywords) in the meta keywords tag. For instance, if I were to write the meta keywords tag for the dog adoption site, I would do it like that: <meta name=“keywords” content=“adopt, adoption, dog, dogs, puppy, canine, save a life, homeless animals”>. It is a small boost to search engine top ranking, but why miss the chance?
2.

Solve : How to set a custom 404 (not found) error page?

Answer»

What do you usually do when you click a URL and encounter a "404 - File Not Found" error? Do you:

1. Click on the BACK button of your browser and go somewhere else?
2. Try to back up one directory in the URL and try again?
3. Write to the webmaster of the site and the referring site to inform them of the situation?

If you are like most people, you'll simply click on the BACK button and try another place. The majority of people don't even know that there are any other alternatives.

You thus need to do something so that you do not lose this group of people who come to your site by following an old link or by typing your URL incorrectly.


Requirements for Customizing the 404 File Not Found Page

If your web host has this facility, you will usually find mention of this somewhere in their documentation. In fact, if they mention somewhere that you can customize a file named ".htaccess", it probably means that you can also customize your 404 File Not Found error page.

The .htaccess file is what Apache web servers use to allow you to fine-tune your web server configurations at a directory level. Other types of web servers handle the customization of 404 error pages differently.


1. Creating/Modifying the .htaccess File

This step may not be necessary in all situations. Some web hosts already configure their web server so that it will look for a specific file in your web directory when a certain document cannot be found. If so, simply skip this step.

If your web server is not an Apache web server, you will have to find out from your web host what you need to do to enable the server to serve your customized file when a file cannot be found.

Otherwise, the first thing you need to do is to add the following line to a file named ".htaccess" (without the enclosing quotes and with the preceding full stop). In most instances, no such file will exist, and you can simply CREATE one with a text editor (such as Notepad on Windows).

ErrorDocument 404 /notfound.html

You will of course need to PUT a "notfound.html" file in the main web directory for the above directive to work.

The "ErrorDocument 404" directive essentially tells the Apache web server that whenever it cannot find the file it needs in that directory and its subdirectories, it is to use the document specified in the URL that follows.

One .htaccess file in your main directory will do the trick for that directory and its subdirectories. However, if you want a certain subdirectory to show a different 404 File Not Found message, you can always place a .htaccess file into that directory. This will override any .htaccess files you have in the parent directories.


2. Creating Your Error Document File

What should go into your custom 404 not found page?

It is insufficient to simply LET the visitor know that the file could not be found. In order not to lose that visitor, you will have to provide him some way to locate the document he wanted, or you would have lost him.

Your page should have one or more of the following things:

1. A link to your main page, with a suggestion that the visitor can find what he wants there.
2. If you have a search engine for your website, you should definitely put a search box on that page. Many people prefer to simply type a query than to scan through your site map.
3. A link to your site map, which lists all the pages on your website.
4. If you know of frequently mistyped URLs on your site, you can even put links to the correct location directly on the page, so that visitors who arrive there from outside can quickly get to the correct page. Remember, you don't want to lose that visitor, so do all you can to help him.
5. Any other navigational aids that you may have - for example, if you have a drop down navigation menu on your normal pages, you should probably put one here as well.

If you like, you can even put a simple form on the page to allow your visitors to inform you of the broken link. However, the primary aim of this page is not to help you track bad links, but to make sure your visitor does not leave your site if what he wants can be found there.

Incidentally, you should make your 404 page larger than 512 bytes, even when you are testing. Otherwise INTERNET Explorer (IE) will load what it calls its built-in "friendly HTTP error message" instead of your 404 page.


3. Testing the Error Document

When you're satisfied with your page, upload it together with your .htaccess file to your website. Then test it by typing a URL that you know does not exist.

Your error page should load up. From this error page, test to see that the links here lead to the pages you intended it to lead.


Common Errors with a 404 Custom Error Page

1. The most common error people have with their custom error page is making a mistake in the URL they put in their .htaccess file. This leads the web server into a LOOP when a visitor tries to access a missing file. When a file cannot be found the server tries to load the file specified in your ErrorDocument directive. But that file does not exist too, so it tries to load the file specified in that directive. You get the idea.
Make sure you test your error file by typing in a non-existent URL. Do not test it by typing its real URL - that will of course work but it will prove nothing.

2. Another common error is to forget that your 404 error page may be loaded either from the main directory or from a subdirectory or even your CGI-BIN directory. When you put links on your 404 document not found page, such as hyperlinks leading to other pages on your site or links to images (such as your logo), be sure that you use the full URL and not a relative link. That is, use things like

<a href="http://www.example.com/sitemap.html">Site Map[/url] [/b]

instead of

<a href="sitemap.html">Site Map[/url] [/b]

The first will work even if the 404 page appears for a missing file in a subdirectory, but the second will not.

3.

Solve : HTML misuse and abuse?

Answer» HTML code misuse, abuse, and ways to correct them.
Question
A guy looked at my HTML code and told me I was forming bad habits. What is he talking about?

Answer
All HTML code serves a specific purpose. Everyone with basic KNOWLEDGE of HTML knows that the

tag is meant for paragraphs, and the quotes are quotes, etc., etc.. However, it is very easy to misuse and abuse these HTML tags by using them for something other than their intended purpose.

Question
Why does it matter what my methods are if the result is good?

Answer
Can you guarantee that? And can you guarantee that it will stay good through time? The big reason not to misuse tags is that browser support for misused code is far from guaranteed. There may be extra spaces in one browser, while it's perfect in another. Simply put, the entire goal of a website is to get it to work on as many browsers as possible while GETTING the right content across. Misused code does the site a disservice in general, and it gets in the way of the main goal of the webmasters, which is to make it work no matter what broswer you use to navigate the web.

Question
But I use [Brand name] designer! I don't edit the HTML code myself!

Answer
I feel your pain. I once wrote a page in a brand name What You See Is What You Get editor. I look back on the code today, and I don't even want to hazard a guess as to what the program was doing when it wrote that code.

To illustrate my point, I opened a leading brand WYSIWYG editor and made the following in Design mode:

Quote

Hello.
This is a sample Web Page.


This is far down...

The code that the program generated follows:

Code: [Select]<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<p>Hello.</p>
<p>This is a sample web page.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>This is far down...</p>

</body>

</html>
I see several very large problems with this code:

  • The document does not specify which version of HTML it is using in the document. All it would take to make it use the latest in HTML is this line at the top:
Code: [Select]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    But it isn't there. So what's it using? 1.0?

  • It uses the META tag, which is deprecated and not necessary.
  • It uses "empty" paragraphs and abuses the non-breaking space.

So, where do most people foul-up? Using deprecated tags isn't really a crime, but in the future it will be a tragedy for the Web Designer who uses them. However, I'm talking about people intentionally using tags for something they weren't meant for. Like the following:

THE

TAG - Everyone knows the

tag, right? it is used to specify paragraphs. However, when people want to make multiple lines of blank space, they often use this code block:

Code: [Select]Words...</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>More words...</p>
These "empty" paragraphs serve absolutely no purpose other than to cause a mess out of your web page. Browser support is hazy at best. To the IT guy who insists on building sites this way, I can only say "lotsa luck".

So how do you make multiple lines, you ask? The answer is simple: Use the
tag. That's the whole tag. Nothing goes after it; it's only purpose is to break one line down - like HITTING the ENTER key.

For example: This code

Code: [Select]<p>This is a paragraph with one sentence.</p>
<br />
<br />
<p>This line is two lines down.</p>
Produces this:

Quote

This is a paragraph with one sentence.




This line is two lines down.

You can also use CSS:

Code: [Select]p.leading
{
padding-top: 2em;
}
Kudos to robpomeroy

This is the same as the paragraph abuse, with one major difference: It will render properly on all browsers. Of course, the non-breaking space ( ) was abused there as well. Why? That's not the point of that special character. It is also abused in another way: Indenting.

Let's say you want to be fancy and indent a paragraph. How does your standard WYSIWYG editor do? It puts non-breaking spaces in there. So what you got is blank space followed by text. Sounds great, right? Wrong.

The problem here is more than shoddy browser support. It doesn't event indent evenly. To prove my point, open Word or Notepad and hit spacebar five times, and type a short sentence. Go down a line, and hit spacebar five times, and type a completely different sentence. Repeat for a few more lines. How it comes out DEPENDS on your font. A mono-spaced font such as courier will show up fine. However, your site isn't courier by default; it's Times New Roman. So what do you get with Times?You might see something like this:



See the problem? I "indented" five spaces, and got that shoddy excuse for organization. That's why people use the TAB key on word processing programs; it is always indented the same amount.

So what's the real purpose of the non-breaking space? Let's say you work for Widget Incorporated and want to make it so that even when the user resizes their window, the words "Widget Incorporated" never break apart in the word wrap. So, you'd type out Widget Incorporated, and you'll get a blank space that looks like an ordinary space, but will never break. The words will stay together! Neat, isn't it?

So how should you indent in a Web Page? With CSS:

Code: [Select]p.indent { text-indent: 2cm; }
Try this in a long paragraph. Don't hesitate to fiddle with the values. For a tutorial on how to use CSS, please read through QA0014.

Though this only covers a couple of the ways that people can misuse tags, there are other ways that people can misuse their code. Empty images is a good example of this. This is used almost as much as empty paragraphs.

Question
Should I stop using XYZ web development, then?

Answer
For simple pages made for a small purpose, no. If, however, you intend to take Web Design seriously, it is a good idea to learn HTML and CSS at a minimum. These tools are essential for creating a site that is simple to write, but beautiful at the end.

However, WYSIWYG editors don't really have serious problems of abuse - no empty table rows, none of that. Their main problem is deprecated tags. However, I've seen all too many HTML coders abusing the HTML tags just to do a simple thing that could easily be done with the appropriate tag.

Note
Technically, the META tag is not deprecated. However, Google and other search engines have "pseudo-deprecated" the META tag. This article has more details:
http://www.yourhtmlsource.com/promotion/metatags.html
This article will be updated periodically with new misuses and abuses.

4.

Solve : CSS in Web Design?

Answer» Changes since ORIGINAL version:Version 1.01 - Small proofreading done; clarifications added.
Version 1.02 - Added section on multiple external style sheets.
Version 1.03 - Added section on IMPORTING style sheets.
Version 1.04 - Added section on CSS comments.
Version 1.05 - Modified section on importing style sheets.
Version 1.06 - Added info on pseudo-classes; corrected terminology.

Note: This tutorial assumes you are familiar with at least basic knowledge of HTML.
Question
What is CSS?

Answer
CSS is short for "Cascading Style sheets". It is a method of formatting text when building HTML Web Pages. Using multiple style sheets will cause them to "cascade", hence the name.

Question
Why should I use CSS?

Answer
There are two very important reasons. The first is that it replaces deprecated tags. Deprecated tags are obsolete tags made obsolete either by newer HTML CODE or by CSS. Browser support for deprecated tags decreases with each new generation, so eventually to comply with newer versions you will need to learn CSS.

Another good reason is that if you use a "master" style sheet, it is possible to change one setting and have it apply to all documents that use that style sheet. Change the layout of 20 tables on 5 pages with one small edit! Impossible, you say? Not with CSS!

Question
How do I use CSS?

Answer
The main syntax of a CSS setting is:

Selector.Class { attribute: value; attribute: value; }

There are also pseudo-classes, such as:

:link - properties of unvisited links.
:hover - properties of links when the mouse is over them.
:ACTIVE - properties of links when they are being visited.
:visited - properties of links users have visited.

Kudos to robpomeroy for name correction and pseudo-classes.

The key for this is as follows:

Selector: Where this class applies. (Each set of values is considered a "class") For example, p.fire would only work with the

tag, and td.fire would only work with the table cell. If you specify an asterisk (*.fire) then this class will work with whatever you assign it to.

TipSo why would you ever use anything besides *.etc, anyway? Well, if you want the same name to mean different things to different tags, you can specify that and only need to use one name.

For example, let's say you wanted to create a fire theme for your web page. Let's also say that you want paragraphs to be red on a black background, and table cells to be black on a yellow background. You could use these CSS classes, even in the same style sheet:
Code: [Select]p.fire { background-color: black; color: red; }
td.fire { background-color: yellow; color: black; }
Both will use the same class name, so when you call classes in HTML you can just specify "fire" across the board and it will effectively apply your theme.

Class: Whatever you want to call it. Ideally, you want it to be short while being descriptive at the same time. In other words, if "one" isn't significant to you, don't name your attribute that.

Attribute: The part of the element you want to modify. Valid attributes include background-color, text-indent, border-style, and more.

Value: What you set the attribute to. For example, a valid text-indent value would be "2%". A valid background-color value could be "black". Acceptable values vary from attribute to attribute.

NOTE: It is not necessary to include the spaces between the { and the code and the }; however, this makes your classes much more readable.

Tip
In order to keep track of what class does what in your style sheets, you will want to implement comments. Comments in CSS are very simple to put in, and they will help identify what your code is about. Comments are placed between /* and */. For example:

Code: [Select]/* Background for the main site */
BODY { background-color: blue; }
Codes can also be multi-line, as in this example:

Code: [Select]/* Background for the site.
Note to IT: Blue not a good color; blends with images */
body { background-color: blue; }
Use them when appropriate, but be careful of overdoing them. You don't need a paragraph on the table cell element; a sentence or two will do.


Now, you need a place to put all these classes, right? Well, there are several methods of doing this. They are:

  • Create an external style sheet. Open Notepad and type in your classes. When done, go to "file" and "save". Under "File types", select "all files(*.*)". Save it in the same folder as your home page. Name it whatever you'd like, but make sure the name ends in .css.


From within your HTML document, make a new line between your and tags. In this new line, type the following:

Code: [Select]<link rel="stylesheet" type="text/css" href="mystylesheet.css" />
replacing "mystylesheet.css" with the name of your .css file.

But those classes are not automatically applied. To apply them, when you make your tag, add 'class="myclass"' to the end. For example, if you had the following class:

Code: [Select]p.fire { background-color: black; color: red; }
Then in your HTML, if you wanted a paragraph to have this style, you'd type this:

Code: [Select]<p class="fire">This text uses a FIRE class!</p>
and you'd get nicely formatted text (assuming you declared the .css file in the tags). This method is ideal for creating a "master" style sheet that applies to the entire site. For example, if you created a style sheet and linked to it in all of your pages, you essentially have applied a style to the entire site. This way, if you want to change the background color of all your pages, you don't have to modify the bgcolor attribute in every page - that attribute is deprecated anyway. Instead, just change the value in your style sheet, and bingo! the whole site changes.

  • Create a style sheet inside your web page, called an internal style sheet. To do this, underneath your link to the .css file (if you use it) type the following:

    Code: [Select]<***style*** type="text/css">
    <***/style***>
    ***PLEASE NOTE: Wherever I use a style tag, I am forced to put the *** in the tags. Do not use those ***'s in your actual tag!

    Between the two <style> tags, place all the classes you would normally put in a .css file.

    TipYou may be thinking: "Why would I use this method when I've got this nifty .css file?" And the answer is this: You use this method if you want one page to be the exception to the overall style. More detail on this later.

  • Use inline styles within the tag. To do this requires no additional tags. Let's return to the p.fire example. You can do this within a <p> tag by typing this:
Code: [Select]<p style="background-color: black; color: red">This paragraph uses a specially-defined FIRE style!</p>
And there you have it: Perfectly formatted text without even defining a style.

TipSo why on Earth would you define this here instead of at the top of the page? You may have already guessed it, but I'll make it perfectly clear: If you want a particular paragraph or cell table to be different from all the rest on the page and site, this is the most efficient way to do it. Should your whole site be designed this way? Nope. Use the first method unless you need exceptions to the rules you specify.
[/list]

Question
Is it possible to use two classes in one element?

Answer
Yes! The fact that you can, I've found, is very freeing. It eliminates the need for an additional class that just combines two other classes. To do this is extremely easy.

Code: [Select]<p class="fire brimstone"></p>
The above code will call the FIRE class and the BRIMSTONE class.

However, you should note that it is possible for two classes to conflict. For an example of this, let's say you have a .css file that includes

Code: [Select]p.fire { background-color: black; color: red; }
and let's also say you have a one-page

5.

Solve : Create a Robots.txt File?

Answer»

This is a useful file that keeps search engines from indexing pages you do not want spidered. Why would you not want a page indexed by a search engine? Perhaps you want to display a page that shows an example of SPAMMING the search engines. This type of page might include an example of repeated keywords, hidden tags with keywords, and other things that could get a page or an entire site banned from a search engine.

The robots.txt file is a good way to prevent this page from getting indexed. However, not every site can use it. The only robots.txt file that the spiders will read is the one at the top Public HTML directory of your server. This means you can only use it if you run your own domain.

Any other location of the robots.txt file will not be read by a search engine spider.

Now, if you have your own domain, you can see where to place the file. So let's take a look at exactly what needs to go into the robots.txt file to make the spider see what you want done.

If you want to exclude all the search engine spiders from your entire domain, you would WRITE just the following into the robots.txt file:

User-agent: *
Disallow: /



If you want to exclude all the spiders from a certain directory within your site, you would write the following:

User-agent: *
Disallow: /aboutme/



If you want to do this for multiple directories, you add on more Disallow lines:

User-agent: *
Disallow: /aboutme/
Disallow: /stats/



If you want to exclude certain files, then type in the rest of the path to the files you want to exclude:

User-agent: *
Disallow: /aboutme/album.html
Disallow: /stats/refer.htm



If you want to keep a specific search engine spider from indexing your site, do this:

User-agent: <Robot_Name>
Disallow: /



You'll need to know the name of the search engine spider or robot, and place it where <Robot_Name> is above.

You can find the official names of all the known robots on http://www.robotstxt.org/.

So, if you need to exclude something from search engine indexing, this is the most effective tool RECOGNIZED by the search engines, so use it to keep the spiders out of any part of your WEB you want them to avoid.


For more info on the Robots.txt file, click here.

6.

Solve : Tutorial Search Engine?

Answer» http://www.webdesigntuts.net/tutorial-search

This is a great search engine utilising the power of Google Search to BRING some of the best development tutorial SITES on the Internet to one PLACE. All the sites indexed are hand-picked by me, so only the best ones are INCLUDED. Find more info on the site.
7.

Solve : Free dynamic scripts...?

Answer»

I see a lot of people posting in this forum LOOKING for scripts to run dynamic content on their site...I also did a search for this site I'm about to list and found four references to it.

The moderator may want to sticky this in this forum for easy access for those looking for some great scripts...

http://www.dynamicdrive.com


Enjoy!You know, that really is a USEFUL site.
I bookmarked it - thanks for that!Very nice website. ALOT of usefull tips.Yeah, I used some of the features on my site.
Great post.That is useful. There's a lot of valuable information on that site. Unless anyone objects, I'm going to go ahead and sticky this.great site discovery..Great Job! So many useful things in thins site. thanks for sharing it.

Be BACK for more, KEEP posting.