DEV Community

Cover image for How to Hide Text in a Logo Using CSS
SnippFlow
SnippFlow

Posted on

How to Hide Text in a Logo Using CSS

To hide the text of a logo and show a background image, you can use this CSS technique. This method uses text-indent to move the text out of the visible area and other properties to keep it hidden without affecting the layout.

a.logo {
    text-indent: -9999px;  /* Shifts the text far off-screen */
    overflow: hidden;      /* Ensures no overflow text is visible */
    white-space: nowrap;   /* Prevents text from wrapping to the next line */
    display: block;        /* Allows setting width and height */
    width: 150px;          /* Sets the width of the logo element */
    height: 50px;          /* Sets the height of the logo element */
    background-image: url('logo.png');  /* URL of the logo image */
    background-size: cover; /* Ensures the background image covers the entire area */
}
Enter fullscreen mode Exit fullscreen mode

Full article: How to Hide Text in a Logo Using CSS
CSS Snippets

Billboard image

Deploy and scale your apps on AWS and GCP with a world class developer experience

Coherence makes it easy to set up and maintain cloud infrastructure. Harness the extensibility, compliance and cost efficiency of the cloud.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay