twitter-bootstrap 如何使用引导程序使面板标题可点击?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23217835/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 20:33:14  来源:igfitidea点击:

How to make panel header clickable with bootstrap?

htmlcsstwitter-bootstrap

提问by kristian

I am trying to create a website for mobile, and I would like the collapse box clickable and not only the text.

我正在尝试为移动设备创建一个网站,我希望折叠框可点击,而不仅仅是文本。

Image

图片

I have uploaded the site. http://kristian-jacobs.dk/mobileapp/

我已经上传了网站。 http://kristian-jacobs.dk/mobileapp/

Thanks in advance.

提前致谢。

采纳答案by knitevision

Well. Here is a workaround. The easiest way is to assign display: blockto your aelement and then setup the clickable area with width& heightin pixels. But setting fixed width and height can impact the responsive nature.

好。这是一个解决方法。最简单的方法是分配display: block给您的a元素,然后使用width&height以像素为单位设置可点击区域。但是设置固定的宽度和高度会影响响应性。

A more advanced and flexible way is to change a bit the HTML structure, so as the awill be inside the panel and then add display: block, but instead of setting the fixed widthand heightyou can use percentiles so as the clickable zone inherits the size of the panel.

一种更高级和灵活的方法是稍微改变一下 HTML 结构,这样a将在面板内然后添加display: block,但不是设置固定的widthheight您可以使用百分位数,以便可点击区域继承面板的大小。

FIDDLE examplewith fixed sizes.

固定尺寸的FIDDLE 示例

回答by adius

Actually you just have to add btn-blockas a class to the atag.

实际上,您只需将btn-block一个类添加到a标签中即可。