mhulse / css-issues

Practical CSS code snippets and examples.
11 stars 1 forks source link

Hide an element #145

Open mhulse opened 6 years ago

mhulse commented 6 years ago

Remove completely, non-SEO or accessible-friendly:

.gone {
    display: none !important;
    visibility: hidden;
}

Hide, but retain SEO and accessible friendliness:

.off {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
}

Hide visually, but retain space:

.ghost { visibility: hidden; }