2 replies [Last post]
luvis
luvis's picture
Offline
newbie
Sweden
Last seen: 1 year 5 weeks ago
Sweden
Timezone: GMT+2
Joined: 2016-04-23
Posts: 2
Points: 3

Would it be possible to replace any regular expressions on a website and insert something else via css? Without actually having access to the site and able to create classes etc. Using a plugin like Stylish for example.

example: On the page someone has written a regular smiley Smile
css replaces that smiley with an emoticon

I realise I might get laughed at but that's okay..

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 day 4 hours ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5342
Points: 2963

Probably not with CSS. But

Probably not with CSS. But with JavaScript yes.

helldog2004
helldog2004's picture
Offline
Enthusiast
Netherlands
Last seen: 3 years 10 weeks ago
Netherlands
Timezone: GMT+2
Joined: 2014-03-02
Posts: 205
Points: 239

You can only do that if you

You can only do that if you are able to add certain classes or id's to the piece of text.
For example if you add <h4 id="text-replace-image"><span>Smiley</span></h4> to the website then the following css command would replace it with an image:

h4#text-replace-image {
  width: 250px;
  height: 25px;
  background-image: url(smiley.png);
}
h1#text-replace-image span {
  display: none;
}

This should replace the id 'text-replace-image' with the smiley.png image and remove the span inside the h4.
But that is about everything you are able to work out with HTML & CSS, just plain text won't be swapped with an image unles you are going to use javascript like Tony said.

Check Maximum Webdesign for your online solutions