Home > Web Front-end > CSS Tutorial > How to Hide Text in a Logo Using CSS

How to Hide Text in a Logo Using CSS

Patricia Arquette
Release: 2024-12-27 19:22:27
Original
550 people have browsed it

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 */
}
Copy after login

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

The above is the detailed content of How to Hide Text in a Logo Using CSS. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template