HTML: apibrėžkite spalvų kodus - kaip tai veikia
HTML spalvas galite apibrėžti skirtingais būdais. Mes parodome, kaip tai padaryti.
Apibrėžkite spalvų kodus HTML formatu
Iš esmės spalvas HTML galite apibrėžti dviem būdais - naudodamiesi spalvų pavadinimais arba šešiakodais. Spalvų pavadinimai yra įsimenamiausi, tačiau dauguma interneto svetainių kūrėjų spalvoms koduoti naudoja šešiakampius kodus:
- Šešioliktainis kodas: šešioliktainis skaičius visada turi šešis skaitmenis, koduojančius spalvas. Pirmieji du skaitmenys žymi raudoną komponentą, kiti du - žalią, o paskutiniai du - mėlyną komponentą. Priešais spalvą visada yra deimanto ženklas: „#“. Taigi raudoną fono spalvą galite apibrėžti taip: „“. Atminkite, kad rašyba pasenusi be stiliaus lentelių. Pvz., Venkite šio kodo: „“.
- Spalvų pavadinimai: Jie iš esmės veikia taip pat, kaip šešioliktainiai kodai. Galite sukurti raudoną foną: „“. Internete galite rasti išsamias lenteles su šimtais spalvų pavadinimų.
Profesionaliau yra perkelti spalvų apibrėžimus į išorinį stilių (CSS). Kitame praktiniame patarime paaiškiname HTML ir CSS skirtumus.