ASP.NET interview questions: – Can you explain CSS (Cascading Style Sheet) and how to create a CSS in ASP.NET?

CSS (Cascading Style Sheet): – Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation semantics (the look and formatting) of a document written in a markup language.

In simple words CSS (Cascading Style Sheet) is used to apply layout and visual style of elements.

CSS (Cascading Style Sheet) is supported by almost all the browsers.

Now, let’s create a simple example to see how exactly we can add a CSS (Cascading Style Sheet) file in your ASP.NET application.

In order to see it practically just follow the following steps.

Step1: – Create a simple ASP.NET web application for that just go to
>> File >> New >> Project >> Web >> Select ASP.NET Empty Web Application.

Step2: – Now add a simple WebForm page in to your Web Application for that just go to >> Solution Explorer >> Right Click on your Project >> Add >> New Item >> Select WebForm.

After adding the WebForm page in to your application, now design your page like below diagram.

Step3: – This is the most important step while using the CSS
(Cascading Style Sheet)
, in this step we just need to add a style sheet for that just go to >> Solution Explorer >> Right Click on your Project >> Add >> New Item >> Select Style Sheet.

Now, let us assume that we have change the background color and text color of the Button control and the TextBox control. In order to achieve the above point we have to add below code snippet in to your StyleSheet1.css file.

.buttonInsert {color:Black;background-color:Green;}
.buttonDelete {color:Black;background-color:Red;}
.buttonUpdate {color:Black;background-color:Yellow;}
.text {color:Black;background-color:Blue;}

In the above code snippet you can clearly see that I have created three different styles for the button control and a single text style for the TextBox control.

Step4: – Now, let’s see how exactly we can use CSS in to your Web

Now, when you run your web application you will see the result like below diagram.

In the above diagram of the result you can clearly see the effect of the CSS declared on the described controls.

Similarly, you can doo a lot with the CSS (Cascading Style Sheet) to make your page attractive and helpful to the user.

See the following video on questions asked in C# and .NET interviews: –

Get more materials on ASP.NET interview questions


See more stuffs on author’s blog for ASP.NET interview questions


About c# and .NET Interview questions

This blog is for developers who want to crack .NET and C# interviews. It has all tips and tricks needed to crack .NET interviews , C# interview , SQL Server interview , Java interview , WCF Interview , Silverlight interview , WPF interview , LINQ interview , Entity framework Interview. Do not forget to watch our Learn step by step video series. Learn MVC in 16 hours:- Learn AngularJS Step by Step:- Learn Design Pattern in 8 hours:- Learn C# and .NET in 60 days:- Learn MSBI in 32 hours:- Learn SharePoint Step by Step in 8 hours:-
This entry was posted in Uncategorized and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s