Although you can use any webeditor of your choice, I am using Visual Studio 2013 for this demonstration. Let’s start by creating a new ASP.NET Web application. Start Visual Studio and click on New Project. Choose the Web Category and choose ASP.NET Web Application as shown below –
Using CSS Selection Pseudo-element to change the Default Selection Style of your WebPage
Although you can use any webeditor of your choice, I am using Visual Studio 2013 for this demonstration. Let’s start by creating a new ASP.NET Web application. Start Visual Studio and click on New Project. Choose the Web Category and choose ASP.NET Web Application as shown below –
HTML5 Picture Element for Responsive Images
To display an image in our HTML pages, we have so far made use of the <img/> element with the source [src] attribute. Here’s an example:
<img src="Images/default.png" alt="Default Logo" />
With varying screen sizes and pixels, handling this image becomes a challenge. Let's create a small example for demonstrating this. I am using the free Visual Studio Community Edition although you can use any other web editor of your choice. Create an empty web application and add a HTML page with the name TestPicture.html in our project. Add the following code:
Remove Vertical Scrollbars in SyntaxHighlighter
Many a times even when not required, a vertical scroll gets added to your code as shown here:
The scroll appears in some browsers (especially Chrome) as the default style set in shCoreDefault.css is overflow: auto. If you do not want a vertical scrollbar, you can always do this:
3D Transform using CSS3 and jQuery Animation
1. CSS3 Selectors.
2. Rounded Corners.
3. Background Decoration.
4. Colors – [Linear Gradients/Radial Gradients].
5. Text Effects.
6. 2D and 3D Transforms.
7. Animations and many more.
Out of these features, in this article, we will look at 3D transform with jQuery animation. Let’s start by creating an empty web application using Visual Studio with the name “QuarterSalesDetails”. For this demonstration, I am using Visual Studio 2013 although you can use a previous edition of Visual Studio too.
Once you click on the OK button, you will see a New ASP.NET Project dialog box where you can choose your own web template based on your develop environment and requirements in your organization. The dialog box is shown below. Please make a choice of Web Forms for this demonstration.
HTML5 and CSS 3 in ASP.NET 4.5 – Part 1
ASP.NET 4.5 by default supports HTML5. To see this in action, let’s create a new empty web site with the name “HTML5SupportPartI” using Visual Studio 2012 as shown below –
For this demonstration I am using Windows – 8 and Visual Studio 2012.
Add a new item to our blank web site which is “Web Form”. I am using the default name of the page which is “Default.aspx”. Once you have added the “Default.aspx” page, observe the “DOCTYPE” in our page. It looks like below –
Most Popular .NET, jQuery and Web Development articles in 2011
Create Triangles using Plain CSS and No Images
CSS code:
#one{
height:0;
width:0;
border-top:80px solid #FFFF01;
border-left:80px solid #00FF00;
border-right:80px solid #0080FF;
border-bottom:80px solid #FE0002;
margin:20px;
}
border,
you can produce complex shapes and orientations without using JavaScript or ImagesCSS3 Code Generation Tools That Save Time
CSS3 Please
CSS3 Generator
CSS3 Generator
CSS3 Sandbox
Ultimate CSS Gradient Generator
Button Maker
CSS: after and before Pseudo Elements
<head> <title>after and before pseudo elements - DevCurry.com</title> <style type="text/css"> ul.bake li:before { content: "Bakery Item: "; font-style:italic; } </style> </head>
OUTPUT
::after Pseudo Element
<head> <title>after and before pseudo elements - DevCurry.com</title> <style type="text/css"> ul.bake li:before { content: "Bakery Item: "; font-style:italic; } ul.bake li:after { content: " " url("yes.jpg"); } </style> </head>
JavaScript, CSS3, Silverlight, ASP.NET, SharePoint articles Link List – July 2011
jQuery, JavaScript and CSS Articles
ASP.NET, MVC and Silverlight articles
.NET and SharePoint Articles
Other Articles
Text Shadow Filter in IE
You can also use the Shadow Filter app to achieve the desired effect. It creates CSS markup for you based on the selected values
Note: In IE9, this feature has been deprecated and the effect of this filter can only be viewed and not printed.
Upside Down Text with CSS3
<title>Turn Text Upside Down - DevCurry.com</title> <style type="text/css"> #divOne { -moz-transform:rotate(-180deg); /* Firefox */ -webkit-transform:rotate(-180deg); /* Webkit */ -ms-transform:rotate(-180deg); /* IE */ -o-transform:rotate(-180deg); /* Opera */ transform:rotate(-180deg); /* future */ position:absolute; } </style>
As you can see, all the major browsers have implemented the rotate property. Each has its proprietary prefix. As you can observe, we have used negative value here and that’s what rotates the text upside down. So –30 degrees is equivalent to 330 degrees and so on.
The text we are rotating here is 'DevCurry.com' kept in a div called 'divOne'.
OUTPUT
Note: You can use the“text-gravity: inverse" style too, but that uses the UTF-8 character generator to turn text upside down.
CSS First-Letter First-Line Pseudo Elements
<head> <title>CSS Psuedo Elements first-letter and first-line (from DevCurry.com)</title> <style type="text/css"> .lor:first-letter { font-size: 2em; } .lor:first-line { color:Blue; font-style: italic; } </style> </head> <body> <p class="lor"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna liqua. </p> <p> Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit </p> </body> </html>
If you observe, the first para is decorated with the ‘lor’ class. The :first-letter increases the font size of the first letter in the paragraph, in our case ‘L’. The :first-line adds a blue font color and changes the text to italics. The result is as shown below:
Remove Border Around Images using CSS
Putting an image inside a link adds a border to it. This is usually done to visually indicate to the user that this image is a link. Check this example:
<body>
<a href="http://www.dotnetcurry.com">
<img alt="progress" src="images/abc.jpg" />
</a>
</body>
If you have a requirement to override this behavior, then here’s how to do so:
<style type="text/css">
img
{
border-style: none;
}
</style>
Now when you view the same image, it is displayed without a border
How to Center a Table inside a Div using CSS
If you have been looking for a simple way to center a table inside a div, then here it is
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
#divOne
{
width:400px;
text-align:center;
border:dotted 1px black;
}
#tblOne
{
width:200px;
margin:0 auto;
border: solid 1px black;
}
</style>
</head>
<body>
<div id="divOne">
<table id="tblOne">
<tr>
<td>R1C1</td>
<td>R1C2</td>
<td>R1C3</td>
</tr>
<tr>
<td>R2C1</td>
<td>R2C2</td>
<td>R2C3</td>
</tr>
</table>
</div>
</body>
</html>
I have seen lot of people missing out on the margin:auto property. Setting margin to auto is the correct way to center a table and works in ‘most’ of the browsers. The border is just for illustration purposes and is not required.
OUTPUT
Change the Color of Hyperlink inside a Container Using CSS
A user recently asked me if it was possible to change the color of hyperlinks placed in a container, instead of changing the hyperlink color of the entire page. Here’s a simple solution to change the hyperlink color only inside divOne:
#divOne a:link
{
color:White;
}
#divOne a:visited
{
color:White;
}
#divOne a:hover
{
color:Black;
}
Similarly if you want to change hyperlink color nested in containers; for eg: a hyperlink kept inside a table inside divOne, use this:
#divOne table a:link
{
color:White;
}
7 Free Tools to Minify your Scripts and CSS
I have been doing a lot of Client-Side development recently and I have found these 7 tools of great help to improve the performance of the website by ‘shrinking’ the size of JavaScript and CSS files, referenced in the site.
JSMin (JavaScript Minifier) - removes comments and unnecessary whitespace from JavaScript files
JSO (JavaScript Optimizer) - allows you to manage your JavaScript and CSS resources and to reduce the amount of data transfered between the server and the client.
Packer – An online JavaScript Compressor
JSCompress.com – Online tool that uses either JSMin or Packer to compress your files
CSS Compressor – Online tool that compresses your CSS file
DigitalOverload JavaScript Minifier – Online tool that minifies your JavaScript files and finally the one I use most frequently:
YUI Compressor – A JavaScript minifier designed to be 100% safe and yields a higher compression ratio than most other tools.
How to Print only Text using CSS
I was recently asked a question of the forums of how to send text only data to a printer. Well it’s not as hard as you think. The <link> tag has an attribute called media. One of the values is called print, which means the style sheet will only be applied when you print the document. You can use this to hide images when you print. Create a new style sheet (print.css) and add the following to it:
img
{
display:none;
}
Then in your page, all you need to do is reference that style sheet, and it will only be used when you print.
<head>
<title>Print Text Only Using CSS</title>
<link rel="Stylesheet" media="print" href="print.css" />
</head>
<body>
<img src="http://www.google.com.au/intl/en_au/images/logo.gif"
alt="Google" />
<p>Faucibus non sit amet elit. Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Integer placerat, dui sed
posuere molestie, urna sapien porta purus, vel sodales ante
erat sed arcu. Nunc semper, diam ut blandit elementum,
ipsum purus vestibulum quam, sit amet auctor est nunc ut
risus. Maecenas vitae justo sit amet erat congue aliquet
molestie commodo odio. Praesent tempor pellentesque nibh.</p>
</body>
The code above is a small HTML page that displays Google’s logo and well as some sample text. When you print this, the image won’t be displayed. You can also do other stuff like changing the font size, font color for print only. This is a very useful thing to know.
Prevent a Dotted Border around a Hyperlink when clicked in FireFox
I recently got bumped with a strange Link behavior. A user had a hyperlink which opened in a new page. When she clicked on it, a dotted border appeared around the Hyperlink as shown below:
I had seen this behavior a couple of times in the past but never thought of a solution until now. After trying a couple of solutions, what worked out was adding the following CSS to the page:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Remove Dotted Border in FireFox</title>
<style type="text/css">
a:focus {
outline: none;
}
</style>
</head>
<body>
<a href="#" id="anchor1">Click Here</a>
</body>
</html>
I have tested the solution in Firefox 3.0 and above and after adding the CSS, the dotted border does not appear anymore when the link is clicked
Aligning Multiple DIV’s using CSS
A very frequently asked question is how to align Multiple DIV’s using CSS. I had recently done a post on Aligning two div's next to each other using CSS
Here’s how to align multiple DIV’s. For simplicity sake, I will aligning 3 DIV’s
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Aligning Multiple DIV's using CSS</title>
<style type="text/css">
.divOuter{
display:inline;
text-align:center;
}
.divInner1, .divInner2, .divInner3{
border: 1px solid;
float:left;
width:150px;
height:150px;
margin-left:3px;
margin-right:3px;
}
</style>
</head>
<body>
<div class='divOuter'>
<div class='divInner1'>First DIV</div>
<div class='divInner2'>Second DIV</div>
<div class='divInner3'>Third DIV</div>
</div>
</body>
</html>
OUTPUT