html图片自适应屏幕大小(手机)

body,button,dd,dl,dt,fieldset,form,h1,h2,h3,h4,h5,h6,input,legend,li,ol,p,select,table,td,textarea,th,ul {
    margin: 0;
    padding: 0
}
body {
    min-width: 320px;
    font-family: ‘microsoft yahei‘,Verdana,Arial,Helvetica,sans-serif;
    color: #333;
    -webkit-text-size-adjust: none
}
fieldset,img {
    border: 0
}
ol,ul {
    list-style: none
}
address,em {
    font-style: normal
}
a {
    color: #000;
    text-decoration: none
}
table {
    border-collapse: collapse
}

#clear {
    clear: both;
    width: 100%;
    background-color: #fff
}
#clear: after {
    display: block;
    clear: both;
    height: 1px;
    content: ‘‘
}

img, fieldset {
    border: 0;
}
img {
    height: auto;
    width: auto\9;
    width:100%;
}
.content-step ul li .red{ color:#e5362b; background:none; width:inherit; vertical-align:inherit}

* {
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    -ms-box-sizing: border-box;
    box-sizing: border-box
}
.doc {
    padding:10px;
    margin: 0 auto;
}
.doc h1 {font-size:16px;color:#333;padding:10px 0;font-weight:500;}
    .shop-title {padding:10px 0;}
    .author {padding:10px 0;font-size:12px;}
    .author span {color:#333;}
    .author a {color:#2B8CB2;}
    .content {padding:20px 0;}
    .f-bold {background-color:#CCC5C0;color:#E5362B;padding:5px;line-height:24px;font-size:14px;}
    .content p {line-height:24px;padding:10px 0;text-indent:2em; font-size:14px;}
    .content-time {padding:20px 0;color:#000;font-weight:500;line-height:40px;}
    .content-time span {color:#000;}
    .content-time em {color:#E5362B;}
    .content-step {}
    .content-step ul {padding:20px 0;}
    .content-step ul li {line-height:30px;color:#5D5D5D; font-size:14px; padding-top:0}
    .content-step ul li .icon{ display:inline-block; background:url(../images/icon.jpg) no-repeat scroll; width:20px; height:20px; background-size:20px 20px; vertical-align:middle; margin-right:8px;}
    .shop-list {}
    .shop-list li {text-align:center;padding:20px 0;}
    .shop-list li p {text-align:left;color:#7A7878; text-indent:2em;}
    .shop-list li img {margin:0 auto;}
    .content-contact {color:#F15050;padding:20px 10px;line-height:30px;text-indent:2em;}
    .cmbc-qrcode {text-align:center;padding:20px 0;}
    .down-cmbc {text-align:center;display:block;margin:0 auto;}
    .down-cmbc img {margin:0 auto;}

/*
@media screen and (min-width: 480px) {
    .doc {
    font-size: 21px
}
}@media screen and (min-width: 640px) {
    .doc {
    font-size: 28px
}
}
*/
.list li{display:-moz-box;
    display:-webkit-box;
    display:box;}
.list li p{ width:90%}
.last{ text-align:right ; font-size:12px; color:#bdbdbd; padding-right:20px; margin-bottom:10px;}

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<meta name="keywords" content="test" />
<meta name="description" content="" />
<title>test</title>
<link rel="stylesheet" type="text/css" href="style/css/mobile.css" />
</head>

<body>
<div class="doc">
  <h1>房屋装修</h1>
  <div class="author"> <span>20014-07-08</span> </div>
  <div class="shop-title"> <img src="style/images/5.jpg" width="640" height="406" alt="" /> </div>
  <div class="content"> <span class="f-bold">家居体验</span>
    <p> 好的家具让当代人心情愉悦,放松,好的家居设计非常重要。 </p>
  </div>
  <div class="content-step"><img src="style/images/step-1.jpg" width="574" height="68" alt="" /></div>
  <div class="content-step">
    <ul>
      <li><span class="icon"></span>免预存</li>
      <li><span class="icon"></span>套餐7.5-8.5折优惠;</li>
      <li><span class="icon"></span>唯一渠道办理终端补贴合约机;</li>
      <li><span class="icon"></span>可为集团客户统一办理集团套餐;</li>
    </ul>
  </div>
</div>
</body>
</html>

注:在html里面插入图片,如果想让图片自适应屏幕的小而不是宽高固定不变可以在css代码里加入img { height: auto; width: auto\9; width:100%; }

html图片自适应屏幕大小(手机)

时间: 2024-08-05 15:37:26

html图片自适应屏幕大小(手机)的相关文章

picturefill + picture 标签 实现兼容性很棒的 响应式图片 自适应 屏幕大小

polyfill 它是一个能够补齐浏览器兼容性问题的一个东西,使用到的<picture></picture>标签 ,并不是所有浏览器都支持,为了实现更好的兼容效果,这里就使用到了这个东西 ,它能在浏览器不支持的时候提供一些替代的方式 ,对于响应式图片,有名的picturefill库能实现兼容性强的‘响应式’图片,对于不支持picture的浏览器,它会用js获取srcset后面的设置,然后决定输出什么样的图片 使用方法 引入js文件(可从cdnjs.com下载) <script

css -- 背景图片自适应屏幕大小

由于<body>标签的图片不能够拉伸, 解决办法: 1.图片不够大,又background属性不能拉伸图片: 2.只能用个div,把其z-index值设为负,并使这个div大小为整个body大小,在div里用<img> 3.body的background属性去掉,要不然会被遮住 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/

bootstrap设置背景图片自适应屏幕大小

css中编辑此样式: 1 2 3 4 .bg {        background:url(图片地址) no-repeat center;        background-size:contain; } 然后在你的div里引用这个样式就行了: 1 <div class="row bg"> 使图片不随滚动条滚动,即固定不动则加fixd,css代码如下: 1 2 3 4 .bg {        background:url(图片地址) no-repeat center

android 应用程序自适应屏幕大小(转载)

android应用自适应多分辨率的解决方法 1. 首先是建立多个layout文件夹(drawable也一样).在res目录下建立多个layout文件夹,文件夹名称为layout-800x480等.需要适应那种分辨率就写成什么.注意:         a.   较大的数字要写在前面:比如layout-854x480而不能写layout-480x854.         b.   两个数字之前是小写字母x,而不是乘号.2. 在不能的layout下调整layout 的长宽等各种设置.以适应不同的分辨率

android 应用程序自适应屏幕大小

android应用自适应多分辨率的解决方法 1. 首先是建立多个layout文件夹(drawable也一样). 在res目录下建立多个layout文件夹,文件夹名称为layout-800x480等.需要适应那种分辨率就写成什么. 注意: a.   较大的数字要写在前面:比如layout-854x480而不能写layout-480x854. b.   两个数字之前是小写字母x,而不是乘号. 2. 在不能的layout下调整layout 的长宽等各种设置.以适应不同的分辨率. 3 最后需要在Andr

iframe去滚动条+自适应屏幕大小

iframe去滚动条 <iframe name="myFrame" id="myFrame" frameborder="0" src="tab.action" style="margin:0 auto;width:100%;height:100%;" scrolling="no"></iframe> iframe自适应屏幕大小 function resetIfra

ios navigationcontroller 滑动返回与webview加载html图片自适应屏幕宽度

1 .ios navigationcontroller 滑动返回 滑动返回是navigationcontroller默认返回按钮自带的功能,如果返回按钮自定义该功能失效, 解决的办法有两个: ① self.navigationItem.backBarButtonItem =   [[UIBarButtonItem alloc]initWithCustomView:button];//这个方法用不了 只能用 self.navigationItem.backBarButtonItem = [ [UI

手机端Html自适应屏幕大小

需要在html<head><meta name="viewport"          content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"> </head>  加入 手机端Html自适应屏幕大小,布布扣,bubuko.com

Atitit html5 Canvas 如何自适应屏幕大小

Atitit  html5 Canvas 如何自适应屏幕大小 可以用JS监控屏幕大小,然后调整Canvas的大小.在代码中加入JS 1 2 3 4 5 6 7 $(window).resize(resizeCanvas); function resizeCanvas() { canvas.attr("width", $(window).get(0).innerWidth); canvas.attr("height", $(window).get(0).innerHe