I have a theme about rentals. The search engine is listing the cities, but when im adding a city, the name and the slug must be same. But for a better SEO, I need to add a prefix like “Detroit-cheap-rentals”
So I must write the city name and the city slug same. In this situation the search engine is looking like “Detroit Cheap Rentals”
I want to get rid of the “Cheap rentals” part with the css so the slug can still be detroit-cheap-rentals.
How can I do this with css?
In this picture, the part I want to delete with css is “Kiralık Villa”
check the picture here please
5
Answers
You can add a class to the li tag and hide it with display:none;
Example HTML:
Example CSS:
use
li[data-value="Kiralık Villa"]
if you want to hide with “save” the place use
visibility: hidden;
if not usedisplay:none
Learn here the difference between
visibility:hidden
anddisplay:none
:To your comment hide part of text:
Set
width
andwhite-space: nowrap;
overflow: hidden;
I don’t think this is possible with pure css, css has first-line, and first-letter selectors, but it is not possible unless you are able to modify the html..
so you can add
css
Or the many other solutions that were already presented..
Another idea would be using js, here a good start.. http://www.dynamicsitesolutions.com/javascript/first-word-selector/?path2=/javascript/first-word-selector/
As I understand, you want to show only the content of the
data-value
in the visible text on each<li>
item?You could do it like this, which will hide the existing text, and show the content of the
data-value
instead.Example of HTML:
Example of CSS: