English 中文(简体)
图一
原标题:Thumbnail of a Portion of an Image While Maintaining Aspect Ratio

我试图从某些图像中制造umb子,每个图像的大小必然相同。

http://jsfiddle.net/scgCN/“rel=“nofollow”>Fiddle与现行代码。 我先在其他一些地点读过,甚至在这里,我刚刚需要确定图像种类的宽度和高度,然后适用过度流通:隐蔽的财产,但似乎在发挥作用。 它仍在改变形象的方面比例。 我知道,我只能简单地去掉高或宽大的财产,但我真的只是想制造100x100的图像。 我尝试了剪辑:但可以说明如何开展工作。 理想的情况是,我想从全方位形象的中心种植100x100,但用剪辑,我认为,如果我的图像的面貌相同的话,我不会这样做。

.thumbnail {
    overflow:hidden;
    width:100px;
    height:100px;
    padding:10px;
    margin-left:10px;
    margin-right:10px;
    margin-top:10px;
    margin-bottom:10px;
    border:10px solid #EEEEEE;
}
最佳回答

using css and html:

www.un.org/spanish/ecosoc 第一解决方案:

<><>>

<div class="imageFrame">
    <img src="your_path" alt="thumb"  />
</div>

http://www.ohchr.org。

.imageFrame {
    overflow:hidden;
    width:100px;
    height:100px;
    padding:10px;
    margin-left:10px;
    margin-right:10px;
    margin-top:10px;
    margin-bottom:10px;
    border:10px solid #EEEEEE;
    position:relative;
}

.imageFrame img{
    position: absolute;
    top:50%;
    left:50%;
    margin-left: -50px;
    margin-top: -50px;
    display: block;
}

www.un.org/spanish/ecosoc 第二个解决办法:

在此,您将不得不利用一些联合材料,将图像陶尔路动态添加到<代码><div类别=“imageFrame”。

<><>:>

<div class="imageFrame" style="background-image: url( your_path );"></div>

css:

.imageFrame {
    overflow:hidden;
    width:100px;
    height:100px;
    padding:10px;
    margin-left:10px;
    margin-right:10px;
    margin-top:10px;
    margin-bottom:10px;
    border:10px solid #EEEEEE;
    position:relative;
    background-repeat: no-repeat;
    background-position: center center;
}
问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签