帝国cms7.5手机端图片不自动适配的处理方法
1.在内容页模板<head> 和 </head>之间添加如下代码<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
img{max-width:100%!important;height:auto!important;width:auto!important}
.newstext img,.content img{max-width:100%!important;height:auto!important;width:100%!important;display:block!important;margin:10px auto!important}
</style>
2.在 </body> 标签前添加:
<script>
!function(){function i(){for(var i=document.getElementsByTagName("img"),t=0;t<i.length;t++)i.removeAttribute("width"),i.removeAttribute("height"),i.style.maxWidth="100%",i.style.height="auto"}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",i):i(),window.addEventListener("load",i)}();
</script>
不如用自适应。 系统太古老了,我这个也是问AI,可行才发的
页:
[1]