草庐IT

html - 悬停时图像摆动(比例效应)

coder 2023-08-10 原文

当我将鼠标悬停在图像上时,我的图像链接有点摆动。我不知道如何解决这个问题:/我在 css 中使用缩放效果使悬停时图片变大一点。

我已经尝试去除阴影效果,但还是一样的问题...

代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="icon" href="icon.ico" type="image/ico" />
<title>THU | TheHardUploader</title>
</head>
<style>
    body{
        margin: 0px auto;
        background-image:url(aa.jpg);
        background-position: center;
        background-attachment:fixed;
        background-color:black;
        background-repeat: no-repeat;
        }
    #main{
        margin: 0px auto;
    }

    .banner{
        height: 210px;
        margin-top: 35px;
        background-color: black;
        -khtml-opacity:.50; 
        -moz-opacity:.50; 
        -ms-filter:”alpha(opacity=50)”;
      filter:alpha(opacity=50);
      filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0.5);
      opacity:.50; 
      border-top: 5px solid gray;
      border-bottom: 5px solid gray;
    }

    .logo{
        margin: 0px auto;
        margin-top: -300px;
        position:absolute;
        margin-left: 40px;
    }

    .recordsbild{
        margin: 0px auto;
        margin-left: 250px;
        position:absolute;
        margin-top: -200px;
    }

    .line{
        position:absolute;
        height: 180px;
        width: 10px;
        background-color: white;
        margin-top: -195px;
        margin-left: 950px;
    }
    .musikstil{
        position:absolute;
        font-family: "Arial Rounded MT Bold";
        font-size: 20px;
        margin-left: 420px;
        margin-top:-50px;


    }

    .musikstil a{
        text-decoration: none;
         transition: opacity .35s ease-in-out;
         -moz-transition: opacity .35s ease-in-out;
        -webkit-transition: opacity .35s ease-in-out;
        color: white;
    }

    .musikstil a:hover{
        opacity: 0.2;
    }


    .menu{
        position:absolute;
        width: 120px;
             opacity: 1.0;
    transition: opacity .25s ease-in-out;
   -moz-transition: opacity .25s ease-in-out;
   -webkit-transition: opacity .25s ease-in-out;
    margin: auto;
    margin-top: -190px;
    margin-left: 1020px;
    }

    .menu a{
        color: white;
        font-family:"Arial Rounded MT Bold";
        text-decoration:none;
        font-size: 20px;
         transition: opacity .25s ease-in-out;
         -moz-transition: opacity .25s ease-in-out;
        -webkit-transition: opacity .25s ease-in-out;
    }
    .dub{
        color:white;
    }

    .hard{
        color: #009cff;

    }
    .glitch{
        color: #744eac;

    }
    .chill{
        color: #bc0096;
    }

    .menulogos{
        position:absolute;
        margin-left: 890px;
        margin-top: -215px;
    }
    .shop{
        position: absolute;
        margin-top: 6px;
    }
    .promoting{
        position: absolute;
        margin-top: 41px;
    }
    .about{
        position: absolute;
        margin-top: 35px;
    }
    .artists{
        position: absolute;
        margin-top: 28px;
    }
    .release{
        position: absolute;
        margin-top: 17px;
    }

    .menu a:hover{
        opacity: 0.2;
    }
    .bannerwrap{
        width: 1280px;
        margin: 0px auto;
    }
    .socialmedia{
        margin: 0px;
        margin-left: 350px;
        margin-top: 20px;
    }

    .socialmedia img{
        -webkit-transform:scale(0.9); /*Webkit: Scale down image to 0.8x original size*/
        -moz-transform:scale(0.9); /*Mozilla scale version*/
        -o-transform:scale(0.9); /*Opera scale version*/
        -webkit-transition-duration: 0.5s; /*Webkit: Animation duration*/
        -moz-transition-duration: 0.5s; /*Mozilla duration version*/
        -o-transition-duration: 0.5s; /*Opera duration version*/
        opacity: 1; /*initial opacity of images*/       
    }
    .socialmedia img:hover{
        -webkit-transform:scale(1.1); /*Webkit: Scale up image to 1.2x original size*/
        -moz-transform:scale(1.1); /*Mozilla scale version*/
        -o-transform:scale(1.1); /*Opera scale version*/
        box-shadow:0px 0px 30px gray; /*CSS3 shadow: 30px blurred shadow all around image*/
        -webkit-box-shadow:0px 0px 30px gray; /*Safari shadow version*/
        -moz-box-shadow:0px 0px 30px gray; /*Mozilla shadow version*/
        opacity: 1;

    }

</style>
<body>
    <div id="main">

      <div class="banner">    
      </div>
     <div class="bannerwrap">
      <div class="logo">
         <img src="logo.png" />
      </div>
      <div class="recordsbild">
        <img src="records.png" />
      </div>
      <div class="musikstil">
        <a href="#"> Dubstep &#11; |</a> 
        <a href="#"> &#11; Hardstyle &#11; |</a>
        <a href="#"> &#11; Glitch Hop &#11; |</a> 
        <a href="#"> &#11; Chillstep</a>
      </div>
      <div class="line">
      </div>
      <div class="menulogos">
        <img src="menulogo.png" />
      </div>
      <div class="menu">
        <a href="#" class='contact'> Contact Us </a>
        </br>
        <a href="#" class='shop'> Shop </a>
        </br>
        <a href="#" class='release'> Releases </a>
        </br>
        <a href="#" class='artists'> Artists </a>
        </br>
        <a href="#" class='about'> About Us </a>
        </br>
        <a href="#" class='promoting'> Promoting </a>
      </div> 
      </div>
      <div class="socialmedia">
            <a href="#" class="fb"> <img src="fb.png" /></a>
            <a href="#" class="youtube"> <img src="youtube.png" /> </a>
            <a href="#" class="twitter"> <img src="twitter.png" /> </a>
            <a href="#" class="soundcloud"> <img src="soundcloud.png" /> </a>
      </div>
    </div>

</body>
</html>

最佳答案

如果您使用的是 webkit 浏览器,以下内容可能会有所帮助。将它添加到您正在制作动画的元素的容器中应该会使动画更流畅。据我了解,它强制浏览器使用硬件加速。

.socialmedia {
     -webkit-backface-visibility: hidden;
}

关于html - 悬停时图像摆动(比例效应),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16208851/

有关html - 悬停时图像摆动(比例效应)的更多相关文章

  1. ruby - 使用 ruby​​ 将 HTML 转换为纯文本并维护结构/格式 - 2

    我想将html转换为纯文本。不过,我不想只删除标签,我想智能地保留尽可能多的格式。为插入换行符标签,检测段落并格式化它们等。输入非常简单,通常是格式良好的html(不是整个文档,只是一堆内容,通常没有anchor或图像)。我可以将几个正则表达式放在一起,让我达到80%,但我认为可能有一些现有的解决方案更智能。 最佳答案 首先,不要尝试为此使用正则表达式。很有可能你会想出一个脆弱/脆弱的解决方案,它会随着HTML的变化而崩溃,或者很难管理和维护。您可以使用Nokogiri快速解析HTML并提取文本:require'nokogiri'h

  2. ruby-on-rails - Rails HTML 请求渲染 JSON - 2

    在我的Controller中,我通过以下方式在我的index方法中支持HTML和JSON:respond_todo|format|format.htmlformat.json{renderjson:@user}end在浏览器中拉起它时,它会自然地以HTML呈现。但是,当我对/user资源进行内容类型为application/json的curl调用时(因为它是索引方法),我仍然将HTML作为响应。如何获取JSON作为响应?我还需要说明什么? 最佳答案 您应该将.json附加到请求的url,提供的格式在routes.rb的路径中定义。这

  3. ruby-on-rails - 使用 Sublime Text 3 突出显示 HTML 背景语法中的 ERB? - 2

    所以我在关注Railscast,我注意到在html.erb文件中,ruby代码有一个微弱的背景高亮效果,以区别于其他代码HTML文档。我知道Ryan使用TextMate。我正在使用SublimeText3。我怎样才能达到同样的效果?谢谢! 最佳答案 为SublimeText安装ERB包。假设您安装了SublimeText包管理器*,只需点击cmd+shift+P即可获得命令菜单,然后键入installpackage并选择PackageControl:InstallPackage获取包管理器菜单。在该菜单中,键入ERB并在看到包时选择

  4. ruby-on-rails - Ruby url 到 html 链接转换 - 2

    我正在使用Rails构建一个简单的聊天应用程序。当用户输入url时,我希望将其输出为html链接(即“url”)。我想知道在Ruby中是否有任何库或众所周知的方法可以做到这一点。如果没有,我有一些不错的正则表达式示例代码可以使用... 最佳答案 查看auto_linkRails提供的辅助方法。这会将所有URL和电子邮件地址变成可点击的链接(htmlanchor标记)。这是文档中的代码示例。auto_link("Gotohttp://www.rubyonrails.organdsayhellotodavid@loudthinking.

  5. ruby-on-rails - 添加回形针新样式不影响旧上传的图像 - 2

    我有带有Logo图像的公司模型has_attached_file:logo我用他们的Logo创建了许多公司。现在,我需要添加新样式has_attached_file:logo,:styles=>{:small=>"30x15>",:medium=>"155x85>"}我是否应该重新上传所有旧数据以重新生成新样式?我不这么认为……或者有什么rake任务可以重新生成样式吗? 最佳答案 参见Thumbnail-Generation.如果rake任务不适合你,你应该能够在控制台中使用一个片段来调用重新处理!关于相关公司

  6. ruby-on-rails - capybara ::ElementNotFound:无法找到 xpath "/html" - 2

    我正在学习http://ruby.railstutorial.org/chapters/static-pages上的RubyonRails教程并遇到以下错误StaticPagesHomepageshouldhavethecontent'SampleApp'Failure/Error:page.shouldhave_content('SampleApp')Capybara::ElementNotFound:Unabletofindxpath"/html"#(eval):2:in`text'#./spec/requests/static_pages_spec.rb:7:in`(root)'

  7. ruby-on-rails - 在 Ruby (on Rails) 中使用 imgur API 获取图像 - 2

    我正在尝试使用Ruby2.0.0和Rails4.0.0提供的API从imgur中提取图像。我已尝试按照Ruby2.0.0文档中列出的各种方式构建http请求,但均无济于事。代码如下:require'net/http'require'net/https'defimgurheaders={"Authorization"=>"Client-ID"+my_client_id}path="/3/gallery/image/#{img_id}.json"uri=URI("https://api.imgur.com"+path)request,data=Net::HTTP::Get.new(path

  8. python ffmpeg 使用 pyav 转换 一组图像 到 视频 - 2

    2022/8/4更新支持加入水印水印必须包含透明图像,并且水印图像大小要等于原图像的大小pythonconvert_image_to_video.py-f30-mwatermark.pngim_dirout.mkv2022/6/21更新让命令行参数更加易用新的命令行使用方法pythonconvert_image_to_video.py-f30im_dirout.mkvFFMPEG命令行转换一组JPG图像到视频时,是将这组图像视为MJPG流。我需要转换一组PNG图像到视频,FFMPEG就不认了。pyav内置了ffmpeg库,不需要系统带有ffmpeg工具因此我使用ffmpeg的python包装p

  9. ruby - 如何使用 Ruby 将 CSV 文件读入 HTML 表格? - 2

    我正在尝试将一个简单的CSV文件读入HTML表格以在浏览器中显示,但我遇到了麻烦。这就是我正在尝试的:Controller:defshow@csv=CSV.open("file.csv",:headers=>true)end查看:输出:NameStartDateEndDateQuantityPostalCode基本上我只获取标题,而不会读取和呈现CSV正文。 最佳答案 这最终成为最终解决方案:Controller:defshow#OpenaCSVfile,andthenreaditintoaCSV::Tableobjectforda

  10. ruby - 如何使用 Nokogiri 解析纯 HTML 表格? - 2

    我想用Nokogiri解析HTML页面。页面的一部分有一个表,它没有使用任何特定的ID。是否可以提取如下内容:Today,3,455,34Today,1,1300,3664Today,10,100000,3444,Yesterday,3454,5656,3Yesterday,3545,1000,10Yesterday,3411,36223,15来自这个HTML:TodayYesterdayQntySizeLengthLengthSizeQnty345534345456563113003664354510001010100000344434113622315

随机推荐