Search code examples
htmlcsszurb-foundationzurb-foundation-5

Corner Ribbon in Responsive Layout


JSFiddle

Im trying to make a corner ribbon for a responsive layout.

I've used the following to position it:

position: absolute;
top: 10px;
left: -100px;

I have the ribbon in place, my issue occurs when the user resizes the screen, how can I always get it so that the ribbon sites in the corner? i've tried playing around with different percentage offsets but it's hit and miss.


Solution

  • don't use width:100% for your ribbon

    fiddle

    .ribbon{
        position: absolute;
        background: black;
        color: white;
        transform: rotate(-45deg);
        text-align: center;
        top: 10px;
        left: -75px;        /* !!! */
        width:200px;        /* !!! */
    }