Can I make a div transparent, but clickable [duplicate]

匆匆过客 提交于 2021-01-27 12:19:41

问题


I am using a vertical slider for my whole webpage. To move between each page I want to click the top/ bottom of the page to navigate between slides. To do this I have placed a div at the top and bottom of each page and when you click that div it brings you to the next/prev slide but these divs are covering some of my content on certain pages. Is there a way to make the divs 'transparent' in colour but still available to click as a link? Sorry if I haven't explained myself properly i am new to HTML an CSS.


回答1:


I'm not sure I get this problem - divs are empty by default (there's nothing in them to make transparent) so as long as you have assigned the clickable div some dimensions it should create a region you can click on where it is located on the page.

e.g. http://jsfiddle.net/pWpAD/ [Top 50px pixels of the box are clickable].

div {
    width: 300px;
    height: 300px;
}
#backdiv {
    background-color: #f0f;
}

#topdiv {
    height: 50px;
    cursor: pointer;
}

If I've not understood your question let me know. Maybe can you provide some code?



来源:https://stackoverflow.com/questions/16348725/can-i-make-a-div-transparent-but-clickable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!