Familii de fonturi

Stefanescu Mihai 2 years ago CSS
Acest articol face parte din cursul Toate lectiile CSS. Te poti inscrie la acest curs aici!

Proprietatea font din CSS se refera la familia fontului, grosimea, marimea si stilul.

Diferenta dintre fonturile Serif si Sans-Serif:

Familii de fonturi CSS

In CSS exista doua tipuri de familii:

-familia fonturilor generice – grup de fonturi ce se aseamana cu “Serif” sau “Monospace”

-Familiile de fonturi – familii specifice precum “Times New Roman” sau “Arial”

Familii Generice

Familii de fonturi

Descrere

Serif Times New Roman
Georgia
Fonturile Serif au mici liniute la sfarsitul anumitor caractere
Sans-serif Arial
Verdana
“Sans” inseamna fara – aceste fonturi sunt identice cu fonturile Serif, dar nu au liniutele de carepovesteam mai sus.
Monospace Courier New
Lucida Console
Toate caracterele au aceasi latime.

Font Family

Familia din care va face parte un text va fi setata cu proprietatea font-family.

Este recomandat sa alegeti mai multe familii de fonturi in caz ca un utilizator nu dispune de cea aleasa de voi, caz in care va incarca al doilea font din lista.

Incepe cu fontul pe care doresti sa il folosesti si termina lista cu un font generic (ce se gaseste cu siguranta pe orice computer).

Atentie: Daca numele unei familii este compusa din mai multe cuvinte trebuie sa il pui in ghilimele.

Exemplu:

p {
    font-family: "Times New Roman", Times, serif;
}

Font Style

De obicei aceasta proprietate este folosita pentru a face un anumit font italic.

Aceasta poate lua urmatoarele valori:

  • normal – Textul este afisat normal
  • italic – Textul este afisat italic (inclinat)
  • oblique – Textul este “aplecat” (in caz ca fontul folosit de tine nu are si versiune de italic).div.normal {font-style:normal;}
    div.italic {font-style:italic;}
    div.oblique {font-style:oblique;}

Font Size

Aceasta proprietate seteaza dimensiunea fontului.

Lucru foarte important in web design, oricum nu ar trebuii sa faci fontul din paragrafe sa arata ca cel din heading (h1, h2, s.a.m.d) sau invers.

Foloseste mereu tag-urile HTML prestabilite <h1> … <h6> pentru heading-uri si <p> pentru paragrafe.

Dimensiunea poate fi absoluta sau relativa:

Absoluta:

  • Seteaza textul la o anumita dimensiune
  • Nu permite modificarea dimensiunii din browser.

Relativa:

  • Seteaza dimensiunea ralitava fata de elementele alaturate
  • Permite modificarea din browser.

! Daca nu setezi o dimensiune textului, acesta va lua dimensiunile standard (ex: paragraful = 16px=1em).

Seteaza dimensiunea in Pixeli

Setarea dimensiunii textului in pixeli iti da control total asupra acestuia:

h1 {
    font-size: 40px;
}

h2 {
    font-size: 30px;
}

p {
    font-size: 14px;
}

Exemplul de mai sus permite browserelor Internet Explorer 9, Firefox, Chrome, Opera si Safari sa modifice dimensiunea.

Nota: Dimensiunea textului poate fi modificata din browser folosind optiunea zoom.

Seteaza dimensiunea in Em

Pentru a evita problemele deredimensionare a textului in versiunile mai vechi de Internet Explorer sunt folositi em in loc de pixeli.

Aceasta unitate de masura (Em) este recomandata de W3C.

Un em este egal cu dimensiunea curenta a textului, care este de 16px…deci 1em = 16px.

Pentru a transforma pixelii in emputeti utiliza formule: pixeli/16=em.

 h1 {
    font-size: 2.5em; /* 40px/16=2.5em */
}

h2 {
    font-size: 1.875em; /* 30px/16=1.875em */
}

p {
    font-size: 0.875em; /* 14px/16=0.875em */
}

In acest exemplu, dimensiunea textului in em este la fel ca cea in pixeli din exemplul anterior. In fine, cu em-uri este posibila redimensionarea textului din browser.

Din pacate, tot exista probleme in versiunile mai vechi de IE.

Combina procentaje cu Em

O combinatie ce functioneaza in toate browserele, seteaza font size pentru tag-ul <body> in procente:

body {
    font-size: 100%;
}

h1 {
    font-size: 2.5em;
}

h2 {
    font-size: 1.875em;
}

p {
    font-size: 0.875em;
}

 

Programator de ~8 ani, am lucrat la proiecte din mai multe industrstrii, de la eCommerce la telecomunicatii la automatizari. In acest timp am folosi diferite tehnologii, de la PHP, MySQL, PostgreSql, RabbitMq, Redis, Memcached si altele.


Get in touch
Pentru nelamuriri, dubii, comentarii si chestii de pe suflet ne putem auzi pe Discord, Reddit sau poti deschide o discutie noua pe forum

Get Actoplus delivered by mail # 5 months ago Order Saxenda online with delivery Low cost Prandin online Prandin without a prescription, where to find illegally? Affordable diabetes medication with home delivery
Finley # 5 months ago I know this web site presents quality based content and additional data, is there any other site which presents such information in quality?
Shelley # 5 months ago Keeep onn writing, great job!
analand a real cum # 5 months ago I do bekieve all of the ideas you've offered on yoir post. Thhey are very convincing and can certainly work. Nonetheless, thee posts arre very brierf for novices. May just yyou please prolong them a little frkm subsequent time? Thank yoou ffor the post.
Dominga # 5 months ago I'm pretty pleased to fiknd this website. I need to to thnk you for ones tme for thus wonderful read!! I definiitely liked every bit of iit andd i also have you saved to fav to checkk ouut new information on yoir website.
Aphrodisiac hottie exposes curves_during_sex # 5 months ago Hey! Thhis iss my fist comment here so I just wanted to givge a quikck sshout outt and ssay I genuinely enjoy reazding youjr posts. Can you suggest any other blogs/websites/forums that ddal with thee same topics? Thans a lot!
Taboo babesJade Nileand Rebel Lynn fuck forbiddencock # 5 months ago It's ann remarkaboe pasragraph inn support off all thhe ohline viewers; thsy will take benefit from it I amm sure.
961 # 4 months ago Ridicuoous story there. What occurred after? Good luck!
069 # 4 months ago It's ttruly a great andd useful piece off information. I'm glad that you jujst shaed this useful information with us. Pease sta us informed like this. Thank youu foor sharing.
SiNncerest Ass # 4 months ago Hi outstabding website! Does runnikng a blog simiar tto tnis require a grest deawl of work? I hav absolutely no understanding of codijng buut I was hoping too start myy oown blog soon. Anyway, if you have anny recommendations oor tijps for new blkog owwners please share. I know this is offf subjct however I jyst needed to ask. Kudos!
614 # 4 months ago Gret blog here! Additionally your site quite a bit upp fast! What host are yyou the use of? Can I get your affiliate hyperlink for yoour host? I wsnt myy web siye loadedd uup as fst as yours lol
350 # 4 months ago Goood day! Thiss iis kind of off topic buut I ned soome help from ann established blog. Is it tough too set uup your own blog? I'm not vey techincal but I can ffigure things out prretty fast. I'm thinking about setting up my oown but I'm noot sure where to begin. Do you haqve any tips or suggestions? Many thanks
303 # 4 months ago Great article, totally what I wanteed to find.
358 # 4 months ago Heey there! I understand this iis somswhat off-topic but I needrd tto ask. Dooes buiolding a well-established blog like yours tak a llot oof work? I am completely new to operating a blog buut I ddo write in my journal everyday.I'd lime tto sart a blpog so I can share my experience and feelings online. Pleasse leet me kmow iif you have any kind of ideas or tips for new asiring blog owners. Thankyou!
889 # 3 months ago My family always saay thaat I am wasting my time here at net, but I knoww I am getting knowledge all thhe time bby reading such nice articles.
Mickey # 2 months ago We are a bunch of volunteers and starting a new scheme in our community. Your web site provided us with helpful information to work on. You've performed an impressive activity and our whole neighborhood will probably be grateful to you.
www.wexcams.com # 1 month ago oof course like yojr website howevver youu need too takje a look at tthe spelliung onn seveeral of your posts. Many of them arre rife wit spelling prohlems aand I find it very troublesome tto infor tthe truth nevertheless I'll ceetainly clme back again.
Fptbgg # 1 month ago cheap fenofibrate 200mg <a href="https://fenoficor.com/">buy fenofibrate pill</a> buy generic tricor 160mg
Zysuqe # 1 month ago ketotifen 1 mg pills <a href="https://geozipin.shop/">buy cheap generic sinequan</a> order imipramine 75mg sale
Ljnpjw # 1 month ago minoxidil drug <a href="https://aminirin.com/">buy minoxidil solution</a> over the counter erectile dysfunction pills
Ydbcwj # 1 month ago acarbose pills <a href="https://dipyxcin.com/">order generic griseofulvin 250mg</a> cost griseofulvin 250mg
Fjpbqf # 1 month ago aspirin for sale online <a href="https://aminirin.shop/">order aspirin 75mg generic</a> where to buy imiquad without a prescription
Mtjwhg # 4 weeks ago buy dipyridamole 100mg pill <a href="https://pravinef.com/">pravachol 10mg generic</a> pravastatin 20mg price
Kzgzwb # 3 weeks ago dydrogesterone sale <a href="https://empaolol.com/">order jardiance 10mg for sale</a> order empagliflozin 10mg
Krystle # 3 weeks ago Hi there! This iis my 1st commen hete sso I juhst wanted too gife a qick shout out aand tedll yyou I reallly njoy reading yopur blokg posts. Can you suggedst any otfher blogs/websites/forums that cover the sqme topics? Thanks for yur time!
Wesley # 3 weeks ago Great post.
Ictlzw # 3 weeks ago buy monograph 600mg online <a href="https://colotazol.shop/">cilostazol 100 mg sale</a> buy generic pletal for sale
http://kheymomo.blogspot.com/ # 3 weeks ago do you already know the vaccines you should give to your new babies come on and visit my site to find out http://kheymomo.blogspot.com/
Dvyaol # 3 weeks ago pill prasugrel 10mg <a href="https://thoramine.com/">cost thorazine 50 mg</a> detrol drug
Sheree # 2 weeks ago Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog that automatically tweet my newest twitter updates. I've been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.
cotrimoxazole 0.52 euro par pilule en pharmacie espagnole # 2 weeks ago If you are going for most excellent contents like me, just go to see this web page every day as it offers feature contents, thanks
Bnsfha # 2 weeks ago ferrous sulfate 100 mg over the counter <a href="https://fertonel.com/">buy ferrous sulfate pills</a> buy sotalol 40 mg online cheap
Hnmubd # 2 weeks ago order mestinon 60mg generic <a href="https://mestien.com/">order pyridostigmine 60mg</a> rizatriptan 5mg cost
Qyqgxk # 2 weeks ago cost enalapril 10mg <a href="https://casosin.shop/">buy cheap doxazosin</a> duphalac cheap
Xpxsok # 1 week ago zovirax over the counter <a href="https://aexeloda.com/">generic capecitabine 500mg</a> cost exelon 3mg
Icqbnc # 1 week ago order generic betahistine 16mg <a href="https://benedolac.com/">buy probenecid 500 mg</a> probalan cost
Wezxew # 1 week ago telmisartan online buy <a href="https://molnenil.shop/">molnupiravir brand</a> buy molnunat 200mg online cheap
Gwsaeq # 6 days ago cenforce tablet <a href="https://chlodinir.com/">chloroquine where to buy</a> chloroquine where to buy
Qbetjk # 4 days ago order omnicef 300 mg generic <a href="https://chlodinir.shop/">order omnicef 300 mg generic</a> purchase lansoprazole online cheap
doxazosin disponible sans ordonnance en Suisse # 1 day ago Everything is very open with a precise clarification of the issues. It was really informative. Your site is useful. Many thanks for sharing!
Noodrq # 6 hours ago atorvastatin online order <a href="https://liptamol.shop/">cost proventil 100 mcg</a> order norvasc for sale
Club-ul este dedicat membrilor si ofera access la mai multe zone ale website-ului.
Login Register

๐Ÿ”– Bookmarks โž•
โœจ Pentru a sustine aceasta comunitate am sa te rog sa te autentifici sau sa te inregistrezi!

๐ŸŒช๏ธ Discord โž•
Back to top
Folosim cookie-uri pentru a oferi functionalitatile critice ale aplicatiei Invata-Programare. Folosim cookie-uri si pentru a analiza traficul, pentru care e nevoie de consimtamantul dvs. explicit.