المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : استبدال نص مكان نص من خلال how to replace word with css



Rise Company
24-01-2019, 10:50
استبدال نص مكان نص من خلال how to replace word with css
How to Replace Text with CSS pseudo-elements :before/:after
How do I replace a word in some text using CSS?
Best way to replace a text using CSS

hide the original content and replace it with a pseudo-element
(::after or ::before).

----------------------------------------------------------------
مثال:
----------------------------------------------------------------

اذا كان لديك كلمة باسم Hello وتريد تغييرها الى Goodbye من خلال كود css


<button>Hello</button>

الحل :


button {
visibility: hidden;
}
button:after {
content:'Goodbye';
visibility: visible;
}

----------------------------------------------------------------
مثال اخر:
----------------------------------------------------------------

اذا كان لديك كلمة باسم ABC وتريد تغييرها الى DEF من خلال كود css

<div class="pvw-title"><span>ABC</span></div>


الحل :



.pvw-title span {
display: none;
}
.pvw-title:after {
visibility: visible;
}

----------------------------------------------------------------
اكواد اخرى :
----------------------------------------------------------------


.element {
text-indent: -9999px;
line-height: 0; /* Collapse the original line */
}

.element::after {
content: "New text";
text-indent: 0;
display: block;
line-height: initial; /* New content takes up original line height */
}



button {
position: absolute;
visibility: hidden;
}

button:before {
content: "goodbye";
visibility: visible;
}


span {
visibility: hidden;
word-spacing:-999px;
letter-spacing: -999px;
}

span:after {
content: "goodbye";
visibility: visible;
word-spacing:normal;
letter-spacing:normal;
}


.company-name{font-size: 0}

.company-name:after{
content: "New Company Name";
font-size: 14px;
}​

المرجع:
https://stackoverflow.com/questions/7896402/how-can-i-replace-text-with-css
https://stackoverflow.com/questions/18066329/how-to-replace-a-specific-text-in-css
https://stackoverflow.com/questions/42488507/how-do-i-replace-a-word-in-some-text-using-css