html - 把 anchor 和 li 放成相同大小

标签 html css

我需要在我的 li 中放置一个 anchor ,使用相同的空间,就好像它只是一个元素一样。实际上,我想构建这个屏幕:http://postimage.org/image/w2q9ei21r/ 我已经有一个刚开始的代码,但是我遇到了一些问题,因为 anchor 没有占用 li 的相同空间。我感谢任何帮助。 http://jsfiddle.net/Br9Km/2/

最佳答案

您可以使用此结构实现图像上呈现的内容:

  • 查看此 working Fiddle让访问者点击的例子 月名!

    在此打印屏幕上,您可以看到鼠标悬停在“Fevereiro”月份上。

    Menu Print Screen

CSS

/* rounded corners */
#ConteudoMeses li, #ConteudoMeses li a, #ConteudoMeses li span {
    border-radius: 10px 10px 10px 10px;
    -webkit-border-radius: 10px 10px 10px 10px;
    -moz-border-radius: 10px 10px 10px 10px;
    behavior: url(/Themes/Default/Scripts/PIE.htc);
}

/* LI element format */
#ConteudoMeses li {
    display: inline-block;
    width: 140px;
    height: 76px;
    margin: 0 0 8px 0;
}

/* link format */
#ConteudoMeses li a {
    display: inline-block;
    font-weight: bold;
    text-decoration: none;
    line-height: 74px;
    width: 110px;
    color: white;
}

/* arrow holder format */
#ConteudoMeses li span {
    float: right;
    display: block;
    height: 74px;
    width: 20px;
}

  • 查看此 working Fiddle让访问者点击的示例 在月份名称和对应的箭头上!

    在此打印屏幕上,您可以看到鼠标悬停在“Fevereiro”月份上。

    Menu Print Screen

CSS

#ConteudoMeses li, #ConteudoMeses li a, #ConteudoMeses li span {
    border-radius: 10px 10px 10px 10px;
    -webkit-border-radius: 10px 10px 10px 10px;
    -moz-border-radius: 10px 10px 10px 10px;
    behavior: url(/Themes/Default/Scripts/PIE.htc);
}
#ConteudoMeses li {
    display: inline-block;
    width: 140px;
    height: 76px;
    margin: 0 0 8px 0;
}

#ConteudoMeses li a {
    display: block;
}
#ConteudoMeses li .label {
    display: inline-block;
    font-weight: bold;
    text-decoration: none;
    line-height: 74px;
    width: 110px;
    color: white;
}

#ConteudoMeses .arrow {
    float: right;
    display: block;
    height: 74px;
    width: 20px;
}

关于html - 把 anchor 和 li 放成相同大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11172591/

相关文章:

HTML5 mp3 音频在 Chrome 和 Firefox 中不起作用

CSS:使子div元素的高度和宽度小于父元素的X像素

CSS:从 Sprite 调整 <li> 背景图像的大小

javascript - 根据另一个 div 设置一个 DIV 的宽度和高度

javascript - 这是什么 JQuery 脚本?

html - 重新排序语义 ui 可堆叠网格中的列

html - 萨斯 CSS :after background image not appearing

html - 跨浏览器适当调整响应图像的大小作为复选框/单选按钮

javascript - 如何仅为打印预览调整 svg 图像的大小?

php - html5 websockets php开发的理想平台