惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
SegmentFault 最新的问题
Y
Y Combinator Blog
Recorded Future
Recorded Future
博客园 - Franky
I
InfoQ
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
T
Tailwind CSS Blog
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
P
Palo Alto Networks Blog
G
GRAHAM CLULEY
Cloudbric
Cloudbric
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MongoDB | Blog
MongoDB | Blog
F
Full Disclosure
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Check Point Blog
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
T
Threat Research - Cisco Blogs
U
Unit 42
N
Netflix TechBlog - Medium
The Cloudflare Blog
Spread Privacy
Spread Privacy
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队
T
Troy Hunt's Blog
Engineering at Meta
Engineering at Meta
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
B
Blog
S
Securelist
H
Hacker News: Front Page
Google Online Security Blog
Google Online Security Blog
G
Google Developers Blog

博客园 - CB

用HTML5 Canvas为网页添加动态波浪背景 SVG 动画实现弹性的页面元素效果 Trianglify – 五彩缤纷的 SVG 背景图案 『转』Photoshop中改进ios设计流程的30个诀窍 【转】6 个强大的 HTML5 应用在线开发工具 【转】2012年度最新免费web开发设计资源荟萃 【转】inline-blcok 前世今生 【转】60款很酷的 jQuery 幻灯片演示和下载 【转载】用CSS3做的动画按钮 【转载】时尚的CSS3进度条 漂亮的表格 6款强大的jQuery插件 创建和加强网站布局 RMB符号的几种显示方式。 [转载] 模仿淘宝列表页面的工具栏随屏幕滚动效果 2010年最佳jQuery插件 网站开发人员应该知道的62件事 - CB - 博客园 转载“精简版”滚动到顶部和底部的jQuery效果 21个精彩的Jquery效果插件 编写跨浏览器兼容的 CSS 代码的金科玉律
【转】[jQuery插件]图片居中裁切效果
CB · 2011-11-30 · via 博客园 - CB

转自《[jQuery插件]图片居中裁切效果 

http://www.css88.com/archives/4202

 大家在做相册列表的时候可能会遇到这样的情况,用户上传的图片大小不一,长宽不一,然而需求的列表却是固定宽高的如图:

此脚本拟达到以下需求

  1. 当图片高或宽超过父容器时截取中间部分显示。
  2. 当图片宽高小于父容器时,居中显示。
  3. 插件中”width”和”height”两个参数可以设定图片实际输出的宽度。
  4. 可以通过样式设置图片的偏移位置,例如.themes2 li a img{ margin-top: -5px; margin-left: -5px};
  5. 第3点和第4点结合可以尽可能的解决一个问题,就是解决图片边缘模糊是造成视觉上的不爽。

demo页面:http://www.css88.com/demo/VMiddleImg/