【问题标题】:HTML image vertical alignHTML图像垂直对齐
【发布时间】:2014-12-18 17:09:25
【问题描述】:

我正在使用 HTML、CSS 和 Jquery,我用手表图像做了一个图像悬停效果,我希望能够在页面中心垂直向下添加多个图像的相同图像和效果,但它不会让我,这是有问题的网站!任何帮助都会很棒!

<div id="header">
    <h1></h1>
</div>
<div class="center12">
    <img src="image/logocenter1.png" alt="** PLEASE DESCRIBE THIS IMAGE **">
</div>
<div id="nav">
    <h2>
        <a href="index.html" class="rollover">Home</a> / <a href="style.html"   class="rollover">Styles & Sizes</a> / 
        <a href="brand.html" class="rollover">Brands & Prices</a> / 
        <a href="strap.html" class="rollover">Watch Straps</a> / <a href="used.html" class="rollover">Tips on buying used</a>
    </h2>
</div>
<div class="fadehover">
    <img src="image/test1.png" alt="" class="a"> <img src="image/test1bw.png" alt="" class="b">
</div>

看起来应该很简单,但行不通。

【问题讨论】:

  • 我不明白你在这里要做什么,只有一个图像区域,你要垂直对齐什么?
  • 我希望能够用不同的图像一遍又一遍地放置它并具有相同的效果
  • 好的,那你用的 JS 呢?
  • 此网址上的 html 是正确的 (designriot.net/wnm250/module-15/index3.html)。现在只放 jquery 脚本通过维护它们之间的关系来更改悬停时的图像。

标签: javascript jquery html css


【解决方案1】:
Instead of using jquery and two images for gray scale effect, use the following:

By adding an css you can bring the same effect using a single image(no need of jquery and hover image).

Add this css:

<pre>
img.a:hover {
    filter: url("");
   }
</pre>

and remove the jquery and another gray scale image. If you don't want hover effect and the images are needs to be shown one by one down, remove one of the images inside the div and put it into a separate Div'

【讨论】:

  • 我愿意,但它是一个类项目,它需要在网站上有 jquery。
  • 你要一张一张有悬停效果的图片吗?还是后面有多个图像?
  • 您可以使用 jquery 对单个图像执行此操作,如下所示:
  • 抱歉忘记添加 :)
猜你喜欢
  • 2021-07-11
  • 2010-12-03
  • 2022-12-23
  • 2016-09-06
  • 2019-05-20
  • 2014-11-30
相关资源
最近更新 更多