简体   繁体   English

如何减小按钮的大小

[英]How to reduce size of button

I've got some JavaScript which is making my whole page clickable through what I though was the container element.我有一些 JavaScript 使我的整个页面都可以通过我认为是容器元素的内容进行点击。 However, when I tried reducing its size, amd reducing the size of the associated widget, even the footer is clickable.但是,当我尝试减小它的大小,并减小相关小部件的大小时,甚至页脚也是可点击的。 Although the footer doesn't toggle according to the JavaScript code, it does toggle in as far as it reacts to the a href "#" and takes user to the top of the page when they are trying to select an element/link in the footer.尽管页脚不会根据 JavaScript 代码切换,但它确实会切换到它对a href "#"做出反应并在用户尝试 select 中的元素/链接时将其带到页面顶部页脚。

So how can I can I get the footer to stop being clickable?那么我怎样才能让页脚停止可点击呢? The page itself seems only to react when clicking elements on it, but almost the whole footer area is reacting to href#页面本身似乎仅在单击其上的元素时才会做出反应,但几乎整个页脚区域都在对href#

<a id="mni" href="#">
<div class="container4" onclick="myFunction(this)">
     <div class="nimageone">
          <img  src="http://4309.co.uk/wp-content/uploads/2020/05/IMG_20200509_165113-1-219x300.jpg" alt="" width="350" height="300" c.class="size-medium wp-image-14178" /></div>
     </div>
     <script>
         function myFunction(x){
              x.classList.toggle('change');
         }
     </script>
</div>

Css Css

.change 
.nimageone img {display:none}

desktop here桌面在这里

You have not included the tree structure of your HTML element comprehensively.您没有全面包含 HTML 元素的树结构。

You can achieve what you are trying to do with the following.您可以通过以下方式实现您想要做的事情。

    <div>
   <a id="mni" href="#">
   <div class="container4" 
     onclick="myFunction(this)">
    <div class="nimageone"><img 
    src="http://4309.co.uk/wp-  
   content/uploads/2020/05/IMG_20200509_165113-1- 
  219x300.jpg" alt="" width="350" height="300" class=" 
   size-medium wp-image-14178" /></div>
  </div>


 </a> //remember to close the <a> tag here before the 
footer item

 /////Your footer item can come below here 
<footer>
</footer>
</div>

If you want to adjust the size of the button in the HTML you can set it just like you set the width and the height attributes in the 'img' tag.如果您想调整 HTML 中按钮的大小,您可以像在“img”标签中设置宽度和高度属性一样设置它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM