شما اینجا هستید

شبه عنصر برای استایل دادن به قسمت خاصی از یک عنصر به کار میرود.

برای مثال، آن میتواند برای استایل دادن به اولین حرف یا خط هر عنصر به کار رود. همچنین از آن میتوان در درج کردن محتوا قبل و بعد از محتوای یک عنصر استفاده کرد.

سینتکس

نحوه دستوری شبه عنصر به صورت زیر است :

selector::pseudo-element {
    property:value;
}

 

به دو نقطه دوتایی "::" در سینکس توجه کنید، برای ایجاد تفاوت بین شبه کلاس و شبه عنصر از آن استفاده میشود.

 

شبه عنصر first-line::

شبه عنصر first-line:: برای افزودن استایل ویژه به اولین خط از یک متن به کار میرود.

مثال زیر اولین خط از متن را در همه عناصر <p> قالب بندی میکند.

<html>

<head>

<style>

p::first-line {

    color: #ff0000;

    font-variant: small-caps;

}

</style>

</head>

<body>


<p>You can use the ::first-line pseudo-element to add a special effect to the first line of a text. Some more text. And even more, and more, and more, and more, and more, and more, and more, and more, and more, and more, and more, and more.</p>


</body>

</html>

 

شبه عنصر first-line:: فقط میتواند روی عناصر بلاکی اعمال شود.

 

شبه عنصر first-letter::

شبه عنصر first-letter:: برای افزودن استایل ویژه به اولین حرف از یک متن به کار میرود.

مثال زیر اولین کلمه از متن را در همه عناصر <p> قالب بندی میکند.

<html>

<head>

<style>

p::first-letter {

    color: #ff0000;

    font-size: xx-large;

}

</style>

</head>

<body>


<p>You can use the ::first-letter pseudo-element to add a special effect to the first character of a text!</p>


</body>

</html>

 

شبه عنصر first-letter:: فقط میتواند روی عناصر بلاکی اعمال شود.

ترکیب شبه عنصر و کلاسهای CSS

به صورت زیر شبه عنصر را میتوان با کلاسهای CSS ترکیب کرد:

<html>

<head>

<style>

p.intro::first-letter {

    color: #ff0000;

    font-size:200%;

} 

</style>

</head>

<body>


<p class="intro">This is an introduction.</p>

<p>This is a paragraph with some text. A bit more text even.</p>


</body>

</html>

 

مثال بالا اولین کاراکتر از پاراگرافی که با کلاس intro مشخص شده است را بزرگتر و با رنگ قرمز نمایش میدهد.

 

شبه عنصر چندتایی

چند شبه عنصر را میتوان با هم ترکیب کرد.

در مثال زیر، اولین حرف از پاراگراف قرمز و بزرگ میشود. بقیه خط اول آبی و کوچک میشود و بقیه پارگراف با رنگ و اندازه پیشفرض نمایش داده میشود:

<html>

<head>

<style>

p::first-letter {

    color: #ff0000;

    font-size: xx-large;

}


p::first-line {

    color: #0000ff;

    font-variant: small-caps;

}

</style>

</head>

<body>


<p>You can combine the ::first-letter and ::first-line pseudo-elements to add a special effect to the first letter and the first line of a text!</p>


</body>

</html>

 

شبه عنصر before::

با استفاده از شبه عنصر before:: میتوان قبل از محتوای یک عنصر، محتوا درج کرد.

مثال زیر یک تصویر را قبل از عنصر <h1> درج میکند:

<html>

<head>

<style>

h1::before {

    content: url(smiley.gif);

}

</style>

</head>

<body>


<h1>This is a heading</h1>

<p>The ::before pseudo-element inserts content before an element.</p>


<h1>This is a heading</h1>

</body>

</html>

 

در مثال بالا با استفاده از ویژگی content که مقدار آن آدرس یک تصویر بود قبل از محتوای عنصر <h1> تصویر را درج کردیم.

شبه عنصر after::

با استفاده از شبه عنصر after:: میتوان بعد از محتوای یک عنصر، محتوا درج کرد.

مثال زیر یک تصویر را بعد از عنصر <h1> درج میکند:

<html>

<head>

<style>

h1::after {

    content: url(smiley.gif);

}

</style>

</head>

<body>


<h1>This is a heading</h1>

<p>The ::after pseudo-element inserts content after an element.</p>


<h1>This is a heading</h1>

</body>

</html>

 

شبه عنصر selection::

شبه عنصر selection:: برای قسمتی از متن که کاربر انتخاب کرده است به کار میرود.

مثال زیر متن انتخاب شده را با رنگ قرمز و پس زمینه زرد نمایش میدهد:

<html>

<head>

<style>

::-moz-selection { /* Code for Firefox */

    color: red;

    background: yellow;

}


::selection {

    color: red;

    background: yellow;

}

</style>

</head>

<body>


<h1>Select some text on this page:</h1>


<p>This is a paragraph.</p>

<div>This is some text in a div element.</div>


</body>

</html>

 

دیدگاه‌ها

viagra jokes for women how do u get viagra viagra in action viagra effects of viagra eyesight trails

how to use viagra for maximum effect fastest shipping for viagra viagra without a doctor prescription mandy flores accidetal viagra/hamsterr viagra generic availability

https://viagrnetwork.com/# - viagra without a doctor prescription

quick loans rates quick cash loans quick loan quick safe loans quick n loans

quick online loans quick and loans rates quick loan how quick does sallie mae report loans paid off 50000 quick loans

www.american.bank/loans#loan-quick-pay quick loans no credit check same day quick loans quick personal loans quick cash loans no credit check reviews

quick loans albany ga quick loans phoenix az quick loan quick loans 100% approval quick 200 dollar loans

https://paydailoanz.com/# - quick loan

how to start a blog and make money how much money do youtubers make work from home make money blogging how to make money on youtube videos

make money online surveys how to make money on youtube videos make money ways to make money from home how did mark cuban make his money

https://make-money-blogs.com/# - work from home

make money at home how to make money selling drugs work from home how to make money as a kid how did tom steyer make his money

how to make money online from home photos imgclick easily make money sharing will friends social free file upload work from home how did betsy devos make her money how does facebook make money

https://make-money-blogs.com/# - make money

imgclick will easily make money sharing photos friends social free file upload easy ways to make money online make money how to make money with a website make money online

how do youtubers make money how to make money on instagram work from home how does venmo make money easy way to make money

https://make-money-blogs.com/# - make money

make money online from home how to make money without a job work from home make money online surveys how to make money on amazon

hobbies that make money how do you make money on youtube make money make money make extra money

http://ocotisp.ru/ - make money

how does facebook make money how to make money without a job make money how to make money on twitch how to make money with youtube

best way to make money how to make money on amazon work from home ways to make money online ways to make money online

http://www.smartarchitect.ru/ - make money

make money taking surveys how do you make money on youtube make money how can i make money best ways to make money online

how to make money as a kid make money apps work from home how to make money quick ways to make money from home

http://0fm.ru/ - work from home

buy hemp oil hemp cbd buy cbd oil

apple cider vinegar and weight loss optivia weight loss weight loss hypnosis for weight loss extreme weight loss

june shannon weight loss melissa mccarthy weight loss before and after weight loss sota weight loss apple cider vinegar weight loss

https://weight-loss-blogs.com/# - weight loss

homemade items that make money quick ways to make money make money online how does craigslist make money imgclick will easily make money sharing photos friends social free file upload

how to make money on the internet how to make money from home make money online make extra money how to make money

https://www.fresher.ru/elz/# - make money

make money online make extra money make extra money how does craigslist make money make money at home

how to make money on the internet making money with pornhub how to make money online fast how much money can i make on social security work from home jobs amazon

https://make-money-blogs.com/# - make extra money from home

coronavirus vaccine for dogs symptoms of coronavirus in cats cdc mers coronavirus the coronavirus coronavirus 229e isolation precautions

dog coronavirus equine coronavirus respiratory coronavirus coronavirus cat symptoms of coronavirus in cats

https://pharm-usa-official.com/coronavirus/# - coronavirus treatment

best ways to make money online money online how much money does pewdiepie make quick ways to make money passive income opportunities

money making apps making money home work legitimate work from home opportunities work from home

https://make-money-blogs.com/# - best way to make money online

arise work from home send money online how to work from home making money from home how to make money on instagram

how does facebook make money how to make quick money best way to make money online how to make money on youtube work at home

https://make-money-blogs.com/# - online money

healthy recipes for weight loss fast weight loss apple cider vinegar for weight loss best foods for weight loss loose skin after weight loss

shark tank weight loss drink golo weight loss best weight loss pills optivia weight loss prescription weight loss pills

https://weight-loss-blogs.com/# - apple cider vinegar weight loss

joe thomas weight loss best weight loss apps weight loss supplements weight loss clinic near me best weight loss pills 2019

keto weight loss pills weight loss coffee weight loss programs celine dion weight loss melissa mccarthy weight loss

https://weight-loss-blogs.com/# - honey boo boo weight loss

healthy snacks for weight loss calorie calculator for weight loss before and after weight loss weight loss clinic near me breakfast smoothies for weight loss

sota weight loss best protein powder for weight loss intermittent fasting weight loss weight loss clinics near me weight loss clinic near me

https://weight-loss-blogs.com/# - calorie calculator for weight loss

keto weight loss pills joe thomas weight loss weight loss pills hypnosis for weight loss loose skin after weight loss

gabourey sidibe weight loss before and after weight loss smoothie recipes best weight loss diet weight loss shakes macros for weight loss

https://weight-loss-blogs.com/# - chrissy metz weight loss

best weight loss program weight loss tips weight loss supplements weight loss programs apple cider vinegar for weight loss

boogie2988 weight loss weight loss weight loss before and after weight loss smoothies loose skin after weight loss

https://weight-loss-blogs.com/# - before and after weight loss

step sister helps viagra boner multiple erections and viagra viagra viagra average age normal dose of viagra

can i overcome ed without viagra purchasing viagra on the internet viagra boys viagra generic viagra india 100mg

https://pharm-usa-official.com - viagra

how long does it take for viagra to work mom son viagra viagra viagra and tribulus does viagra show up in probation urine test

viagra side effects canadian viagra work? viagra viagra mistake viagra bdsm

https://pharm-usa-official.com - viagra

tadalafil 20 mg generic tadalafil cheap tadalafil generic cialis tadalafil best buys tadalafil vs sildenafil

tadalafil 5 mg tadalafil vs viagra tadalafil cialis cialis tadalafil tadalafil avis

https://supertadalafil.com/ - tadalafil dosage

tadalafil cost cvs buy tadalafil tablets generic cialis tadalafil purchase peptides tadalafil tadalafil powder

tadalafil 40 mg adcirca tadalafil cheap tadalafil buy tadalafil tablets tadalafil 20 mg best price

https://xtadalafilx.com/ - cialis tadalafil

tadalafil cost generic cialis tadalafil tadalafil dosage adcirca tadalafil tadalafil tablets 20 mg

purchase peptides tadalafil tadalafil en ligne tadalafil 20mg tadalafil 5mg prix tadalafil online

https://supertadalafil.com/ - cialis tadalafil

tadalafil lilly tadalafil generic cialis 20 mg tadalafil 20mg tadalafil 10 mg side effects for tadalafil

tadalafil generic vs cialis tadalafil vs viagra tadalafil liquid mylan tadalafil generic cialis tadalafil 40 mg

https://xtadalafilx.com/ - cheap tadalafil

weight loss programs weight loss tips best weight loss pills best weight loss pills smoothies for weight loss

protein shakes for weight loss best way to lose weight diet plans what is noom weight loss program easy weight loss tips

https://weight-loss-blogs.com - fastest way to lose weight

tadalafil 5mg prix mylan tadalafil tadalafil cialis tadalafil 20 mg wirkungsdauer tadalafil side effects

generic cialis tadalafil 40 mg buy tadalafil tablets tadalafil 20mg tadalafil generic vs cialis tadalafil tablets 20 mg

https://supertadalafil.com/ - liquid tadalafil

tadalafil 40 mg tadalafil canadian pharmacy buy tadalafil online tadalafil lilly 5mg prix cheap tadalafil

tadalafil biogaran prix tadalafil dosage generic tadalafil tadalafil 5mg tadalafil prix en pharmacie

https://xtadalafilx.com/ - tadalafil liquid

golo weight loss apple cider vinegar weight loss celine dion weight loss weight loss calculator healthy diet

lose weight fast apple cider vinegar weight loss how to lose weight quick diets best weight loss pills

https://weight-loss-blogs.com - medi weight loss

side effects for tadalafil tadalafil generic vs cialis tadalafil 5mg tadalafil 20 tadalafil 20 mg wirkungsdauer

tadalafil 20mg avis tadalafil 20 mg tablet tadalafil cialis tadalafil 10 mg tadalafil biogaran prix

https://supertadalafil.com/ - cheap tadalafil

tadalafil tablets 20 mg tadalafil 20 mg tablet tadalafil generic tadalafil mylan tadalafil side effects

generic cialis tadalafil 20 mg from india tadalafil 20 mg prix tadalafil reviews tadalafil lilly 5mg prix tadalafil biogaran prix

https://xtadalafilx.com/ - tadalafil 20 mg

cialis generic cialis tadalafil tadalafil vs vardenafil tadalafil 5mg side effects for tadalafil cialis vs tadalafil generic

cheap tadalafil tadalafil tablets liquid tadalafil tadalafil generic cialis 20 mg generic tadalafil

https://supertadalafil.com/ - generic tadalafil

tadalafil online tadalafil dosage buy tadalafil online tadalafil biogaran prix tadalafil 20 mg prix

tadalafil 20mg tadalafila 20mg cheap tadalafil tadalafil pronunciation tadalafil liquid

https://xtadalafilx.com/ - tadalafil 20 mg

testosterone overdose testosterone booster supplements how to increase testosterone testosterone cream testosterone meaning

best testosterone boosters 2019 testosterone cypionate best testosterone supplements for men what is testosterone what is testosterone

https://pharm-usa-official.com/testosterone.php - testosterone injections

testosterone meaning testosterone overdose testosterone booster testosterona signs of low testosterone in men

low testosterone treatment que es testosterona testosterone injections increase testosterone naturally masterburation testosterone

https://pharm-usa-official.com/testosterone.php - what is testosterone

viagra vs cialis levitra for sale vardenafil levitra generic levitra online generic levitra

levitra coupon generic levitra online generic levitra levitra price online levitra

https://drugstoreonliner.com/ - levitra com

increase testosterone testosterone propionate testosterone replacement therapy testosterone pellets is testosterone a steroid

testosterone cream for men testosterone injections for men testosterone definition canadian pharmacy testosterone cypionate prime male testosterone booster

https://pharm-usa-official.com/testosterone.php - testosteron

testosterone definition testosterone boosters testosterona francine niyonsaba testosterone condition low testosterone in women

low testosterone in women francine niyonsaba testosterone condition Trenbolone 200 testosterone definition male sex hormone

https://pharm-usa-official.com/testosterone.php - GP Oxan

viagra results before and after hgh viagra for sale viagra viagra cheap stepsis makes stepbro's viagra boner won't go away

viagra costs without insurance peyronie's disease and viagra viagra what symptoms does viagra treat buy viagra superfoods aruba

https://pharm-usa-official.com - viagra

norton antivirus avast free antivirus download https://xantivirusx.com/ - avast antivirus download free dating sites dating online https://onlinedatingwow.com/ - tender dating sweepstakes contestgirl sweepstakes https://supersweepstakesx.com/ - pch sweepstakes #8800

mcafee antivirus best free antivirus https://xantivirusx.com/ - norton antivirus login xname xname dating lds singles online dating https://onlinedatingwow.com/ - badoo dating site best publications sweepstakes wheel of fortune sweepstakes https://supersweepstakesx.com/ - winloot sweepstakes

resorts online casino
hollywood casino free slots
https://playcasinoslotsx.com - akwesasne mohawk casino hogansburg ny
weight loss pills
how to lose weight quick
https://weight-loss-blogs.com - weight loss surgery
how to make money from home
how to make money
https://make-money-blogs.com - how to earn money

صفحه‌ها

افزودن دیدگاه جدید

دیدگاه

  • تگ‌های HTML مجاز: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • خطوط و پاراگراف‌ها بطور خودکار اعمال می‌شوند.
  • نشانی صفحه‌ها وب و پست الکترونیک بصورت خودکار به پیوند تبدیل می‌شوند.

Plain text

  • تگ‌های HTML مجاز نیستند.
  • نشانی صفحه‌ها وب و پست الکترونیک بصورت خودکار به پیوند تبدیل می‌شوند.
  • خطوط و پاراگراف‌ها بطور خودکار اعمال می‌شوند.
كد امنيتي
این پرسش برای جلوگیری از ارسال اسپمهای اتوماتیک است.