html中图片自适应浏览器,宽度高度自适应,图片自适应屏幕的小而不是宽高固定不变

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Show.aspx.cs" Inherits="Wlxxs.Web.Xxs.Show" %>

<!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></title>
    <style>
        html, body
        {
            padding: 10px;
            margin: 0 auto;
            height: 0 auto;
            max-width: 640px;
            font-family: "微软雅黑";
        }        .mainimg
        {
            text-align:center;

            }
            #Image1{height: auto; width: auto\9; width:100%;}
    </style>
</head>
<body>
        <div class="mainimg">
            <asp:Image ID="Image1" runat="server" />
        </div>
</body>
</html>

注:在html里面插入图片,如果想让图片自适应屏幕的小而不是宽高固定不变可以在css代码里加入

#Image1{height: auto; width: auto\9; width:100%;}

时间: 2024-08-03 19:23:02

html中图片自适应浏览器,宽度高度自适应,图片自适应屏幕的小而不是宽高固定不变的相关文章

div 导航自适应浏览器宽度

<!DOCTYPE html> <html> <head> <title>自适应宽度</title> <style> #condition{float:left; text-align:center; } #condition ul{margin-top:0px; display:inline-block; } #condition ul li{ float:left; list-style:none; } </style>

三栏布局(二)——上下宽高固定,中间自适应

上下宽高固定,中间自适应的几种布局方式, 有4种布局方式:   position;   flex;    table;   grid. <!DOCTYPE html><html> <head> <meta charset="utf-8" /> <title>上下固定,中间自适应</title> </head> <style type="text/css"> html *

三栏布局(二)-------上下宽高固定,中间自适应

上一篇写的是左右宽高固定,中间自适应,根据上一篇的内容,总结了下上下宽高固定,中间自适应的几种布局方式,话不多说,直接上代码. <!DOCTYPE html> <html> <head> <title>上中下三栏布局</title> <style type="text/css"> html * { padding: 0; margin: 0; } html, body{ height:100%; } .layout

C# 压缩图片到指定宽度,假如图片小于指定宽度 判断图片大小是否大于指定大小(KB) 如果大于则压缩图片质量 宽高不变

class Program { static void Main(string[] args) {//G:\zhyue\backup\projects\Test\ConsoleApplication1\img //var url = "http://seo.jrechina.com/houselist/"; //var res = WebRequestExt.GetData(url); string img_url = @"D:\Documents\Pictures\壁纸\1

三列布局,其中左侧和右侧的部分宽度固定,中间部分宽度随浏览器宽度的变化而自适应变化

第一种方法:绝对定位 <!DOCTYPE html> <html> <head> <title>三列布局</title> <link rel="stylesheet" type="text/css" href="task0001.css"> </head> <body> <div class="wrap"> <di

android安卓onCreate方法中获取控件宽度高度

ViewTreeObserver vto = imageView.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { public void onGlobalLayout() { imageView.getViewTreeObserver().removeGlobalOnLayoutListener(this); int height=imageView.getHeight();

html中图片自适应浏览器和屏幕,宽度高度自适应

1.(宽度自适应):在网页代码的头部,加入一行viewport元标签. <meta name="viewport" content="width=device-width,initial-scale=1" /> viewport是网页默认的宽度和高度,上面这行代码的意思是,网页宽度默认等于屏幕宽度(width=device-width),原始缩放比例(initial-scale=1)为1.0,即网页初始大小占屏幕面积的100%. 2.(字体自适应):字体

用纯css3绘制的能自适应浏览器的哆啦a梦动画

最近在研究用css3绘制矢量图,于是就用纯css3绘制了能自适应浏览器宽度的哆啦a梦动画,兼容css3的浏览器都可以正常观看,下面只是网页截图: 废话不多说了,直接给代码. html 代码: <div class="dlam" title="用纯css3绘制的能自适应浏览器的哆啦a梦动画"> <div class="bozi"> <div class="lingdan"> <div c

宽度高度不固定的div如何水平居中与垂直居中(转)

宽度高度不固定的div如何水平居中与垂直居中 很多新手在写css的时候经常遇到的一个问题,当div没有固定的宽度或者高度的时候,如何才能让div水平或者垂直居中显示. 如果div有固定宽度的话,用padding,margin都很容易实现.方法有很多种.不过经常遇到这种div没有固定的宽度高度的情况,我们就不能用margin,padding设置固定的距离了.这个问题让很多人头疼.而怎么样才能让这个div居中显示呢?其实这种情况解决的办法也是有很多种,js,css都可以实现. 这里主要介绍一下采用c