网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站建设 > 帝国Cms
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

Reply
 
Thread Tools Display Modes
  #1   IP: 180.125.101.123
Old 2014-03-28, 02:06 PM
topvip topvip is offline
超级版主
 
Join Date: 2006-01-04
Posts: 1206
topvip 正向着好的方向发展
Default 如何图片太大撑破表格图片自适应图片按比例缩小问题

打开skin/default/css/style.css,

css里加这个
img {
max-width:560px;
myimg:expression(onload=function(){
this.style.width=(this.offsetWidth > 560)?"560px":"auto"}
);
}


上边的代码在默认情况下是控制整个网站的,这样就出现一个问题, 首页中间的长图片条也被缩小了。 可以用下边的思路解决问题。

我们可以给不同的内容模板设置不同的css文件。如“默认新闻内容模板 ”页,打开它,将
<link href="[!--news.url--]skin/default/css/style.css" rel="stylesheet" type="text/css" />

改成:

<link href="[!--news.url--]skin/default/css/newstyle.css" rel="stylesheet" type="text/css" />

然后再进入skin/default/css,复制一个style.css,并将复制的文件改成newstyle.css, 然后再打开newstyle.css, 将 img css控制代码改成:

img {
max-width:560px;
myimg:expression(onload=function(){
this.style.width=(this.offsetWidth > 560)?"560px":"auto"}
);
}

这样就不要改style.css中的img css了。

Last edited by topvip : 2014-03-29 at 07:58 AM
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 10:54 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.