html - css metro 瓷砖选择的风格

标签 html css microsoft-metro tile

我正在尝试在选择效果后将 div 样式设置为 Metro 样式磁贴。我添加了 border-top:28px solid #4390df;到 div,但我无法为磁贴选择效果。任何帮助将不胜感激。

下面是我的要求草图 enter image description here

My fiddled code is here

<div class="tileSelected">
    this is test content
</div>

.tileSelected{
    border-width: 4px;
    border-top:28px solid #4390df;
    border-left:28px solid transparent;
    display:block;
    content:"";
    height:100px;
    width:100px;
    background-color:black;
    color:#fff;
}

最佳答案

我不认为 border 是解决这个问题的方法。生成的内容是将勾号放在右上角的更好选择。你可以用文本来做,但是一个小的勾号图像会更容易,就像这样:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>

.tileSelected {
    height:100px;
    width:100px;
    background:black;
    color:#fff;
    position: relative;
}

.tileSelected::before {
    content: "";
    width: 28px;
    height: 28px;
    top: 0;
    right: 0;
    position: absolute;
    background: url(tick.png);
}

</style>
</head>
<body>

<div class="tileSelected">
    this is test content
</div>

</body>
</html>

关于html - css metro 瓷砖选择的风格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21867570/

相关文章:

c# - 如何在任何给定时间引发事件

html - 为什么 text-shadow CSS 属性在这里不起作用?

html - 滚动条在 IE7、FF 和 Chrome 的自动调整大小框中表现不佳

jquery - 使用修改后的 bootstrap walker 代码 - onClick 未将 'open' 类添加到父 LI

HTML 制作一个三部分的内容框

html - 跨度对齐中心与 img 标签

html - 浏览器不断呈现其缓存版本。我想总是强制 GET

javascript - IE9 检测不到 PC 上安装的字体

c# - 在 Windows 8 Metro (WinRT) 和 C#/XAML 中,实现流动项目结果(即连续分页)的最佳实践是什么?

javascript - 对于 WinJS 应用程序,我应该使用 getElementById 还是直接引用元素?