Your Ad Here

Your Ad Here

The most basic mistake in CSS

The most basic mistake in CSS

Well, we use CSS, no matter how complex the style sheet becomes, we tend to do some very basic mistakes that might result into catastrophic results. Today I will cover a very simple mistake. Let us assume this piece of style which seems correct

#pa {

Background: red;

font-family: Arial,georgia,sans-serif;

font-weight: bolder;

font-style: normal;

text-decoration: underline;

font-variant: ;

font-size: 0px;

width:500px;

height:300px

overflow: auto;

}

It seems like a perfect style sheet, but it will not actually have a scroll bar in it. No matter how much text is entered. So where is the problem, the problems exists in the line

height:300px

it has no terminator at the end of the property.  The property overflow is treated as being related to height some how. But this is wrong.

So the correct code is

#pa {

Background: red;

font-family: Arial,georgia,sans-serif;

font-weight: bolder;

font-style: normal;

text-decoration: underline;

font-variant: ;

font-size: 0px;

width:500px;

height:300px;

overflow: auto;

}

Now on entering excess text we see there is a scroll bar. Regardless of the number of property, you should always put the terminator (i.e. ; ) at the end of each property so when you decide to add a property later you don’t get to face any problems. It is a basic problem that we often face.

Your Ad Here

Posted on June 24th, 2009 by Mutedart  |  No Comments »

About the Ads on The Blog

I have placed a few ads on my website. I hope they do not bother the readers..

If they do kindly let me know … Thanks and have a good day..

Admin

Posted on June 21st, 2009 by Mutedart  |  No Comments »

Cloud Computing: The Beginners Guide

Cloud Computing: The Beginners Guide

The topic every one is talking about now a days. It is actually a computing paradigm, the paradigm of the future. What is actually cloud computing? I define it as the generation of computers that utilizes servers some where in the cloud for data storage, management or computing resources allowing the world to become more efficient in technology. So what is the point of it? Let us consider a company that provides an online solution to some thing. And it is a software solution. They charge some thing for the solution, the data storage is provided, even if they don’t charge, Let us consider what things they have to look in. they need to look into things like overhead costs, customer satisfaction, etc. The most important thing is customer satisfaction. As if the customer is not satisfies the customer might simply leave the service. And if a customer is satisfied with the service, he/she might recommend the software to other users.

Now if the companies number of clients increase, they need more storage. Normally this costs the company buying new servers, and hiring highly trained staff to handle the servers. If there is a trend in decrement for the time period for some reason, the servers are still there and being operated, This means they have to pay whether they are using there servers or no. Giving rise to another point Server is not cheap and not possible for every one to maintain. So this is where we can talk about cloud computing. With cloud computing, we contact a company that provides services that is cloud computing. What is the point? We can get the same server capability for a far lesser amount and there are no hardware problems to deal with. The company that provides the cloud has to deal with the actual hardware. We can get resources at an instant click, and we can get rid of them when ever we don’t need them we can get rid of them. It is like a pay as you go service. Only you pay for what you have been using. Well there are three very big advantages of cloud computing, which are scalability, instantaneous and saves money.

Let us getting back to the solution the company was providing. With cloud computing, the company can now focus on there solution and forget about the issues with the hardware of the servers. And make a better solution by improving their solutions. It does not require any maintenance.

There are 3 trends in cloud computing which are Virtualization, Utility Computing and Software as a Service. So in simple words cloud computing, is the future of computing which can affect the business quite a lot if it is used properly.

Posted on June 18th, 2009 by Mutedart  |  2 Comments »

Connecting a style sheet with a HTML file

Connecting a style sheet with a HTML file:

Today I will tell you how to import a style sheet into a HTML file, it is very simple. There are a few ways of doing it. So let us being…

Method 1: Writing a style sheet within a HTML page

Well after the <title> in the <head>, we mention that we are giving a link to a style sheet and start coding there. This is what the html code will look like

<html>

<head>

<title>Untitled-1</title>

<link rel=”stylesheet” type=”text/css”>

<style type=”text/css”>

h1{

background:black;

color:white;

}

background:black;

/** and so on and so forth the styling can be continued**/

</style>

</head>

If your web has not a lot of styling involved then only I recommend, because if your webpage is totally based on a lot of styles, then it gets rather complicated or if the style is being imported to many pages.

Method 2: Linking to an external style sheet

In the head we can import an external style sheet. The advantage to this is that it can be applied to as many pages without having to put the whole CSS code into the HTML file.

<html>

<head>

<title>Untitled-1</title>

<link rel=”stylesheet” type=”text/css” href=”/style/style.css” media=”all”>

</head>

Well if you see href=”/style/style.css”, this is more like a hyperlink to the style sheet. Well indeed it is a hyperlink to the style sheet. Now an important piece of information, you should place the link in the href from the root to the web site. Most of the websites use this method, as it is better and easier to implement. And changes can be made much more easily as compared to method 1 of adding styles to your web page.

We can multilink that is connecting multiple style sheets; here is a specific pattern by which results comes. We can embed 2 or more style sheets by the following code

<html>

<head>

<title>Untitled-1</title>

<link rel=”stylesheet” type=”text/css” href=”/style/style.css” media=”all”>

<link rel=”stylesheet” type=”text/css” href=”/style/style_new.css” media=”all”>

</head>

Method 3: Importing a style sheet

This is a built in declaration that we can use to import a style sheet into a HTML page. The syntax is as follows

<html>

<head>

<title>Untitled-1</title>

@import url(styles/style.css);

</head>

Method 4: Inlining style sheets

We can put our styles individually to elements, this can be done as follows:

<p STYLE=”color:red; background: black; align: center”>This paragraph will be styled as red text on black background.</p>.

So this is about it. I hope you understood the basics of connecting a style sheet with an HTML file. In case of any questions feel free to contact. Have a great day .

Posted on June 12th, 2009 by Mutedart  |  2 Comments »

Links in CSS

Styling links using CSS:

Link styling, a very basic concept that can be achieved using CSS. How to style your links? A question many face. Well there are many tutorials on how to make fancy buttons, attractive buttons, and professional buttons. But what are the basics of the whole thing? I will be explaining the basics of link styling, I won’t go into the exact styling but a general explanation of the whole thing.

So starting with the very basics of links

In a plain html file, we have our link is link

<a href=”home_page.html” target=”_self” >Home Page </a>

Not so complicated and not so styled as well. It will look very simple and in most cases it will not suit the over all page layout if your page is totally custom. So there we have either use java scripting to make image rollovers as links, or very simply style them. It seems the word styling is very common in the article. But to be honest styling is a very basic tool to enhance the page look without needing to get into very complicated methods or very sophisticated coding. I am assuming here you know how to import or connect or embed a style sheet (i.e. a CSS file) into an HTML file. So the first thing is the basic selectors in styling links. There are 4 selectors in styling links which are:

a:link – the default look of a link at a page load

a:visited – this is activated for a link that has been viewed

a:hover – As soon a mouse is taken over a link, it generates the code on that link

a:active- the code is generated when that page is being viewed

These are often called linked pseudo classes. Well this is every thing we need in order to style our links. A little explanation of each selector is described with it. The first thing we can do is add a background, change the font family, vary the size of the font, change the color of the font, add a border, etc. there are many things we can play around with here.

There can be a few scenarios though those need to be looked into, let us start…

The first scenario is where we want all the links to have a single style applied. This is relatively very simple. No need of id’s, classes, etc. the code of the CSS file can simple be,

/**Styling of links**/

/***Note: we can continue adding as many things as we want. I am just giving a few examples here.

a:link{

background: black;

color: white;

text-decoration: none;

}

a:visited {

background: #333333;

color: white;

text-decoration: none;

}

a:hover {

background: #990000;

color: black;

text-decoration: underline;

}

a:active{

background: black;

color: #990000;

text-decoration: underline;

}

Well this was the first case. Not considering a somewhat complicated case; in which we have top panel of buttons, a side bar, and a body where the buttons come. So now we have the fun part. Getting indulged in inserting <div>, and introducing id’s, classes etc.

The first thing we need to see is will the same style be applied to various locations in a page. In case the answer is YES, we will implement classes in these situations. Other wise if its being implemented to an id that is it is going to unique and used only once. So how to implement an id

Top Links come here… <div id=top>

Side links come here

<div class=side>

Body comes here links of body

<div id=body>

Side links also come here

I did not mention the html code. In case you need it for the above table let me know. I would post it; Implementation in CSS. The ids, classes that is required are given in the table it self.

The code for CSS is as follows

/****For the ID=top****/

#top a:link {

/**Styling for Normal link here**/

}

#top a:visited {

/**Styling for visited link here**/

}

#top a:hover {

/**Styling for Hovering here**/

}

#top a:active{

/**Styling for Active link here**/

}

/****For the class=side****/

.side a:link {

/**Styling for Normal link here**/

}

.side a:visited {

/**Styling for visited link here**/

}

.side a:hover {

/**Styling for Hovering here**/

}

.side a:active{

/**Styling for Active link here**/

}

/****For the ID=body****/

#body a:link {

/**Styling for Normal link here**/

}

#body a:visited {

/**Styling for visited link here**/

}

#body a:hover {

/**Styling for Hovering here**/

}

#body a:active{

/**Styling for Active link here**/

}

That is the basic layout of the code to call the ids or classes for styling the links. The styling will be done in the { }. I have mentioned before what can be done to the links.

So I guess this is about it. Very simple styling help. I tried to explain the very basics of ids, classes and styling. If you have any questions leave them as comments I will try to help you out as soon as possible.

Posted on June 10th, 2009 by Mutedart  |  No Comments »

Scroll bar in a cell of a table using CSS

Scrolling a cell in a Table using CSS:

Have you ever faced a problem, that you wanted to have a scrollable cell inside a table, or the problem that you made the template in Adobe Photoshop, and had kept a fixed area in cell and let the user scroll in that particular cell. So what is the solution to this? Well Thanks to CSS, it gives us enough power to control this option. So here is a very simple solution to that problem.

Looking at the html code for a table,

<table width=”505″ height=”235″ border=”0″>

<tr>

<td>&nbsp;</td>

<td>&nbsp;</td>

</tr>

<tr>

<td>&nbsp;</td>

<td colspan=”2″> Scroll bar will come in this cell </td>

</tr>

</table

So now we have to give the Cell of the table that is going to be scrollable an ID. I won’t be going into the explanation of an id now. We need to define a div tag (i.e. <div>) in the cell so the code of the table becomes

<table width=”505″ height=”235″ border=”0″>

<tr>

<td>&nbsp;</td>

<td>&nbsp;</td>

</tr>

<tr>

<td>&nbsp;</td>

<td colspan=”2“><div id=”scroller”>Scroll bar will come in this cell </div></td>

</tr>

</table>

The code highlighted in red is the code added. Remember we will be using this id for the scroll bar.

Now moving to the CSS code, I am assuming here that you have sufficient knowledge about CSS, that you can create and import or link a CSS file to an HTML file.

Now I will just be writing the CSS code

#scroller { width: 400px;

height: 400px

overflow: auto;

}

We can add other styling if we want but since this is our prime requirement we don’t have to. Now explanation of the code, I am identifying that the id scroller must have these rules to it. Now since an id cannot have two copies in a single HTML file you do not need to worry about having the problem in your HTML file. In case you want multiple cells to have the same rules applies. Try using class instead of id. Now in the style sheet we have width, this is a property that will define what the FIXED width will be. Now the height defines the height, and finally comes the overflow property. This defines what the browser WILL do when extra content is added to the cell. It makes a scroll bar.

So there you have it, a scroll bar in a cell. A problem solved, and it works with Internet Explorer 6 and Firefox 3.

Have a good day.


Posted on June 8th, 2009 by Mutedart  |  No Comments »

Technorati Profile

Posted on June 6th, 2009 by Mutedart  |  No Comments »

Quote of the day: 5 June 2009

Two Backups are better than one ….

Posted on June 5th, 2009 by Mutedart  |  No Comments »

Quote of the day- June 3 2009

Always Master that what you are good at….

Posted on June 3rd, 2009 by Mutedart  |  No Comments »

Quote of the day- 2nd June 2009

Some times you need to put some white spaces rather than filling the space up….

Majid

Posted on June 2nd, 2009 by Mutedart  |  No Comments »