English 中文(简体)
有没有办法用这个元素来"切"背景?
原标题:Any way to "cut" background with the element?

我需要剪切一个背景的 div 和标题 如下方式:

虽然很容易在坚固的背景上(通过设置内嵌区块的元素,并使用与主的相同 bg 颜色)实现,但当背景为图像时,它并不真正有效:

/

能否对第二个例子产生同样的效果?

最佳回答

CSS3的解决方案是 http://dabblet.com/gist/2788465 -- 它使用最小标记和符号。

在 IE9 < a href=" http://dabblet.com/gist/2788690" rel="nofollow" >http://dabblet.com/gist/2788690 中也使用另一种解决办法。

另一个在 IE7 和 IE8 < a href="http://jsfiddle.net/thebabydino/Njtzb/"rel="nofollow"中工作 http://jsfiddle.net/thebabydino/Njtzb/

问题回答

也许不是最好的解决办法, 但你可以做这样的事情:

假设 HTML 标记类似 :

<div id= outer >
  <div id= heading >
    <span id= date >May 20th, 2012</span>
    ...
  </div>
</div>

如果 outer 的背景是图像,而 标题 的背景是虚线,您可以设置 blogin-image 的背景与 outer 一样,然后设置 backlack-position 背景位置 以与元素相同的数量抵消该图像,因此它与其他背景排序。





相关问题
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....

jquery ui dialog opens only once

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.

Drop down background url in Safari Issue

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 ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

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 ...

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 ...

CSS problem with page footer

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: ...

热门标签