在“分层”上滚动;元素...可能吗?

发布于 2024-09-16 23:48:08 字数 673 浏览 4 评论 0原文

我将如何执行以下操作,最好只使用 CSS(但也可能是 jquery)和 PHP。

我有一个 div 区域,button_background,它有一个背景图像。该 div 内部有一个 A 标签,其背景覆盖了该 div 的背景。 (这是一个半透明的“播放”三角形 png,覆盖了视频中的静态图像)。我想在翻转时更改 A 标签的背景(为较暗的三角形)。

来自:

-------------
| ($still)  |
|     \     |
|      \    |
|      /    |
|     /     |
-------------

-------------
| ($still)  |
|    *\     |
|    **\    |
|    **/    |
|    */     |
-------------

注意,我是从 PHP 生成的,按钮背景图像的 url 是一个名为 $still 的变量。

这是粗略的 html:

<div class="button_background">
  <a class="button_overlay" href="page.html"></a>  
</div>

How would I do the following, preferably just using CSS (but possibly jquery too) and PHP.

I have a div area, button_background, which has a background image. Inside that div is an A tag, which has a background that overlays the div's background. (it's a semi-transparent 'play' triangle png which overlays a still from a video). I would like to change the A tag's background (to a darker triangle) on rollover.

From:

-------------
| ($still)  |
|     \     |
|      \    |
|      /    |
|     /     |
-------------

To

-------------
| ($still)  |
|    *\     |
|    **\    |
|    **/    |
|    */     |
-------------

Note that I'm generating this from PHP, and the button background image's url is a variable called $still.

Here's the rough html:

<div class="button_background">
  <a class="button_overlay" href="page.html"></a>  
</div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梨涡 2024-09-23 23:48:08

您可以使用较暗的图像开始,并将 CSS 中的初始状态设置为较低的不透明度。

a.button_overlay { 背景:url(images/triangle.png); opacity:0.5;}

悬停时将不透明度更改为 1,IE 将需要 MS 特定的过滤器属性。

您还可以只使用精灵图像(同一单个 PNG 图像中三角形的深色和浅色版本),然后更改悬停时的背景位置。

you could use the darker image to start with and set the initial state in the CSS to a lower opacity.

a.button_overlay { background:url(images/triangle.png); opacity:0.5;}

on hover change the opacity to 1, IE will need a MS specific filter property.

You could also just use a sprite image (both dark and light versions of the triangle in the same single PNG image) and just change the background-position on hover.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文