Saturday, 13 December 2014

Resize Image On The Bases Of Browser Size Using Css In Asp.Net

12/13/2014 - By Pranav Singh 0


This article will show you how you can resize image on the bases of browser size and this will display the responsive image development in asp.net using css.



So for this article first we will create a new asp.net application an add the below code in to  your asp.net page.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="WebApplication1.WebForm3" %>

<!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 runat="server">
    <title>Resize Image On The Bases Of Browser Size Using Css In Asp.Net</title>
    <style>
        .resize
        {
            display: inline;
        }
        .resize img
        {
            max-width: 90%;
            max-height: 90%;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="resize">
        <img src="Desert.jpg" alt="Img" />
    </div>
    </form>
</body>
</html>

Please check the above css code.

    <style>
        .resize
        {
            display: inline;
        }
        .resize img
        {
            max-width: 90%;
            max-height: 90%;
        }
    </style>

In above code we have defined the the max height and width. So in this  case if we resize the the browser the the image size will also get changed automatically.

Please check the output.
 
Now resize browser the image size will change as  per your resize

 

Tags: ,
About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Global Classified : Connectseekers.com
© 2014 aspdotnet-pools.com Designed by Bloggertheme9.
back to top