Question

I am trying to style a div to metro styles tile after select effect. I added border-top:28px solid #4390df; to the div but I am unable to get selected effect for the tile. Any help would be highly appreciated.

Below is sketch for my request 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;
}
Was it helpful?

Solution

I don't think border is the way to go with this. Generated content would be a better option for putting that tick in the top right corner. You could do it with text, but a small tick image would be easier, like so:

<!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>

OTHER TIPS

you must create the selected : before and after

.tile.selected:before {
position: absolute;
display: block;
content: "\e003";
color: #fff;
right: 0;
font-family: 'metroSysIcons';
font-size: 9pt;
font-weight: normal;
z-index: 102;
top: 0;

}

.tile.selected:after {
position: absolute;
display: block;
border-top: 28px solid #4390df;
border-left: 28px solid transparent;
right: 0;
content: "";
top: 0;
z-index: 101;

}

you can visit this fiddle Metro Tile

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top