我只想在2个单独的小区显示一个形象的前半和同一形象的下半部。
I ve Trial with the CSS property clip
, but it doesn t to support % as a unit.
难道这只是我吗? 你们是否有办法只展示一半的形象?
我只想在2个单独的小区显示一个形象的前半和同一形象的下半部。
I ve Trial with the CSS property clip
, but it doesn t to support % as a unit.
难道这只是我吗? 你们是否有办法只展示一半的形象?
<>Update(5+年后):
社会保障局的不动产现在被折旧。 考虑采用单价办法(允许采用非JS办法),允许你用百分比来说明形状。 例:
/* Bottom half of image */
clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0% 100%);
/* Top half of image */
clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);
更多利用百分比创建三角:
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
Original: CSS clip property does not currently support percentages: http://www.w3.org/TR/CSS2/visufx.html#propdef-clip , latest http://www.w3.org/TR/2011/REC-CSS2-20110607/visufx.html#clipping
解决贵问题的办法可以是利用 Java印确定你想要显示的面积,然后在确定
var heightOfImageToDisplay = image.height / 2;
我没有足够声誉来撰写评论。
没有任何文件的解决办法。
你们都需要做的是
clipPath
, which allows you define whatever path you want. 在您的编码中应用<代码>clipPath。
#your-element {
clip-path: url(#clipPathId);
}
如欲了解更多情况,请参见。
You could have the div as position: relative;
and overflow: hidden;
Have the image inside as position: absolute;
并控制图像的展示方式,但将图像的特性设定为
如果你使用固定的高度图像和固定的高度代码<>div,并且你正在手工操作,为什么不把图像作为背景,用<代码>overflow:hidden <和适当的background-position
。 因此,它只是从底线和底线向上向上线的顶端?
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....
I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.
selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...
How do you target specifically safari in css with styles?
Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...
So I ve got a menu with a hover/selected state and it loads fine in IE6/IE7. However when I scroll down the page and put the element outside of the viewport and then back in I get a broken image! I ...
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 ...
I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...