Reputation: 10061
I used awesome font and add text left of the icon. I want to hide the text when it will be browsed in the smaller browser. But I don't understand how to point that text using css. My code is:
<button class="slideout-menu-toggle"><i class="fa fa-bars"></i> Menu</button>
I want to hide the word Menu
when it will be browsed in smaller device. Is there any way to determine the word. I tried add <span>
in the menu but text gets break and display in new line.
Upvotes: 0
Views: 3785
Reputation: 943645
You can't point at text with CSS, only elements.
<span>
overflow: hidden
) when the media query matches the window width you wantUpvotes: 4
Reputation: 54
Display:none hides the text from screen readers too. Instead use
{
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
See this article
Upvotes: 0
Reputation: 2448
try this, I added a span and it didn't break the text.
@media screen and (max-width: 500px) {
.slideout-menu-toggle > span{
display:none;
}
}
<button class="slideout-menu-toggle"><i class="fa fa-bars"></i> <span>Menu</span></button>
Upvotes: 0