HTMLでの色の名前

WBOY
リリース: 2024-09-04 16:34:32
オリジナル
258 人が閲覧しました

HTML の色の名前は、Web およびアプリケーションの設計プロセスにおいて非常に重要な役割を果たします。これは、Web サイトやアプリケーションの外観を変更するだけでなく、アプリケーションをより魅力的でインタラクティブにするのに役立ちます。 HTML のカラー名を HTML コーディング形式に定義するには、さまざまな方法があります。追加の CSS プロパティを使用して、より効果的に使用できます。 HTMLのカラー名を本文部分に含めることでページレベルで使用することができ、特定の要素に個別の色を設定することもできます。 HTML の色の名前は、テキストの色、背景の色、境界線の色、影、グラデーションなどに意図的に使用されます。

構文

  • HTML の色を使用するにはさまざまな方法があります。一つずつ見ていきましょう。
  • HTML カラーの非常に基本的な使用法は、それをテキストに適用することです。単にテキストの色として使用して、テキストをさまざまな HTML カラーで表示します。

1.テキストの色の構文

color : color_name;
ログイン後にコピー

この構文がどのように機能するかを見てみましょう。

<h4 style="color:blue;">Welcome to EDUBCA<h4>
ログイン後にコピー

上記の例では、次のような青色で「EDUBCA へようこそ」というテキストが表示されます。

HTMLでの色の名前

  • HTML カラーを使用して、背景色として追加することもできます。

2.背景色の構文

background-color:color_name;
ログイン後にコピー

この構文がどのように機能するかを見てみましょう。

<p style="background-color:light-green;">
ログイン後にコピー

このカテゴリには、デザイン コースの多数のサブカテゴリにわたるすべてのデザイン情報が含まれています。

HTMLでの色の名前

  • 次の構文を使用して、HTML カラーを使用してテキストまたは要素の周囲に色付きの境界線を追加することもできます。

3.枠線の色 構文: border

value color_name;
ログイン後にコピー

この構文がどのように機能するかを見てみましょう。

<h4 style="border: 4px solid DodgerBlue;"> EDUCBA free certification course </h4>

HTMLでの色の名前

HTMLにおける色の名の種類

HTML で色の名前を定義するにはさまざまな方法があります。色が違うと名前が変わると覚えるのが大変です。したがって、さまざまな色にいくつかの値を与えることが決定されます。一つずつ見ていきましょう。

HTMLでの色の名前

1. RGB 値

  • これは、赤、緑、青のカラー形式値の組み合わせで HTML カラー名を定義する方法の 1 つです。色の強度を 0 ~ 255 の数値で定義するのに使用されるのはどれですか?
  • RGB の組み合わせを使用して黒色を定義したい場合は、RGB(0,0,0) のようになります。ここでは、色のすべてのパラメータが 0 に設定されます。したがって、黒色が表示されます。
  • 別の RGB(0,0,255) と同様に、255 が青の最高値として設定され、その他は 0 であるため、色は青で表示されます。
  • RGB の 3 つの値を同じにすると、灰色の色合いが生成されます。

例: 最も暗い色は RGB (0,0,0)、最も明るい色は RGB(255,255,255) です。

2. 16 進数の値

  • これは、HTML で最も一般的に使用される色名の形式の 1 つであり、色名は 16 進値の形式で定義されます。
  • #rrggbb 形式には、赤の RR、緑の gg、青の bb の値が 00 から 16 進値までの間に配置されます。
  • 色 #00ff00 を定義する 1 つの例を考えてみましょう。これらの値は緑色で生成されます。緑色には最高値 (ff) が含まれており、他の値は 00 に設定されているためです。

3. HSL 値

  • 色相、彩度、明度の形式で HTML カラーを定義する別の形式。
  • ここで、すべての用語を 1 つずつ見ていきます。色相は、 0 ~ 360 の色の度合いとして定義されます。赤は 0、緑は 120、青は 240。
  • 彩度は色の値をパーセンテージで定義します。0% はグレーの色合いを表し、100% はフルカラーを表します。
  • 明度はパーセンテージとしても機能し、黒を 0%、明るくも暗くもないことを 50%、白を 100% と定義します。

4. RGBA値

  • このタイプの HTML カラーは、色の不透明度を定義するためにアルファが使用されるアルファ値を含む、RGB カラーの拡張を定義します。
  • アルファ値は 0.0 {完全に透明} ~ 1.0 {まったく透明ではない} の間になります
  • 例は rgba(255,99,71,0) です

5. HSLA 値

  • 色の不透明度を定義するための HSL カラー値の追加アルファ値と同じように機能します。
  • hsla(8,100%,80%,0) は完全に透明な色です。
  • hsla(8,100%,80%,0.9) はあまり透明ではない色です。

HTML カラー名の使用

Web ページに色を実装するのは簡単で、インラインでも別の CSS スタイルシート経由でも実行できます。

When you are going to be using the same HTML Color Names on a page multiple times, it is a better idea to use CSS Sheet to define and set colors. Conversely, if you only have to use color once or twice, using the inline method is considered better.

1. Using HTML Color Inline

<body>
<h3 style="color: Brown">Brown H3 Heading</h3>
<p style="color: Gainsboro">Gainsboro colored paragraph text</p>
</body>
ログイン後にコピー

2. Implementing in CSS

h1 { color: Brown; }
p { color: Gainsboro; }
ログイン後にコピー

Different HTML Color Codes

Colors can be denoted by using their hex value or their name. HTML has support for the most common colors; in this article, I will share with you 140 names and hex values of these colors. One thing to keep in mind is that you don’t have to limit yourself to these colors; you can use any color picker tool to find the Hex value of any color you want and use it on your web page.

Now that you know what HTML Color Names are and how you can use them in your pages, here is a list of Color names with appropriate color codes:

1. Grey and Black HTML Color Names

Grey and Black colors are, in most cases, perfect for the text color of the page as against a white background; these colors have the best readability. One interesting thing to keep in mind is that modern phones with OLED displays done need any battery power to display Black color; if your audience is going to be on mobile, it is a wise idea to use Black as a background color and white or other light colors as the foreground color.

Code Color
#000000 Black
#0C090A Night
#2C3539 Gunmetal
#2B1B17 Midnight
#34282C Charcoal
#25383C Dark Slate Grey
#3B3131 Oil
#413839 Black Cat
#3D3C3A Iridium
#463E3F Black Eel
#4C4646 Black Cow
#504A4B Gray Wolf
#565051 Vampire Gray
#5C5858 Gray Dolphin
#625D5D Carbon Gray
#666362 Ash Gray
#6D6968 Cloudy Gray
#726E6D Smokey Gray
#736F6E Gray
#837E7C Granite
#848482 Battleship Gray
#B6B6B4 Gray Cloud
#D1D0CE Gray Goose
#E5E4E2 Platinum
#BCC6CC Metallic Silver
#98AFC7 Blue Gray
#6D7B8D Light Slate Gray
#657383 Slate Gray
#616D7E Jet Gray

2.青の HTML 色の名前

青色の下線付きテキストは、ほとんどの Web ブラウザーのデフォルトのリンク スタイルであるため、リンクとみなされます。訪問者がハイパーリンクと間違える可能性があるため、ページ上のすべてのテキストに青色を使用することは避けてください。

#646D7E Mist Blue
#566D7E Marble Blue
#737CA1 Slate Blue
#4863A0 Steel Blue
#2B547E Blue Jay
#2B3856 Dark Slate Blue
#151B54 Midnight Blue
#000080 Navy Blue
#342D7E Blue Whale
#15317E Lapis Blue
#151B8D Denim Dark Blue
#0000A0 Earth Blue
#0020C2 Cobalt Blue
#0041C2 Blueberry Blue
#2554C7 Sapphire Blue
#1569C7 Blue Eyes
#2B60DE Royal Blue
#1F45FC Blue Orchid
#6960EC Blue Lotus
#736AFF Light Slate Blue
#357EC7 Windows Blue
#368BC1 Glacial Blue Ice
#488AC7 Silk Blue
#3090C7 Blue Ivy
#659EC7 Blue Koi
#87AFC7 Columbia Blue
#95B9C7 Baby Blue
#728FCE Light Steel Blue
#2B65EC Ocean Blue
#306EFF Blue Ribbon
#157DEC Blue Dress
#1589FF Dodger Blue
#6495ED Cornflower Blue
#6698FF Sky Blue
#38ACEC Butterfly Blue
#56A5EC Iceberg
#5CB3FF Crystal Blue
#3BB9FF Deep Sky Blue
#79BAEC Denim Blue
#82CAFA Light Sky Blue
#82CAFF Day Sky Blue
#A0CFEC Jeans Blue
#B7CEEC Blue Angel
#B4CFEC Pastel Blue
#C2DFFF Sea Blue
#C6DEFF Powder Blue
#AFDCEC Coral Blue
#ADDFFF Light Blue
#BDEDFF Robin Egg Blue
#CFECEC Pale Blue Lily
#E0FFFF Light Cyan
#EBF4FA Water
#F0F8FF AliceBlue
#F0FFFF Azure
#CCFFFF Light Slate
#93FFE8 Light Aquamarine
#9AFEFF Electric Blue
#7FFFD4 Aquamarine
#00FFFF Cyan or Aqua
#7DFDFE Tron Blue
#57FEFF Blue Zircon
#8EEBEC Blue Lagoon
#50EBEC Celeste
#4EE2EC Blue Diamond
#81D8D0 Tiffany Blue
#92C7C7 Cyan Opaque
#77BFC7 Blue Hosta
#78C7C7 Northern Lights Blue
#48CCCD Medium Turquoise
#43C6DB Turquoise
#46C7C7 Jellyfish
#7BCCB5 Blue green

3. Warna HTML Hijau

Di tapak yang berkaitan dengan alam semula jadi, wang, persekitaran dll, Hijau boleh menjadi pilihan warna yang baik untuk digunakan sebagai latar belakang.

#43BFC7 Macaw Blue Green
#3EA99F Light Sea Green
#3B9C9C Dark Turquoise
#438D80 Sea Turtle Green
#348781 Medium Aquamarine
#307D7E Greenish Blue
#5E7D7E Grayish Turquoise
#4C787E Beetle Green
#008080 Teal
#4E8975 Sea Green
#78866B Camouflage Green
#848b79 Sage Green
#617C58 Hazel Green
#728C00 Venom Green
#667C26 Fern Green
#254117 Dark Forest Green
#306754 Medium Sea Green
#347235 Medium Forest Green
#437C17 Seaweed Green
#387C44 Pine Green
#347C2C Jungle Green
#347C17 Shamrock Green
#348017 Medium Spring Green
#4E9258 Forest Green
#6AA121 Green Onion
#4AA02C Spring Green
#41A317 Lime Green
#3EA055 Clover Green
#6CBB3C Green Snake
#6CC417 Alien Green
#4CC417 Green Apple
#52D017 Yellow Green
#4CC552 Kelly Green
#54C571 Zombie Green
#99C68E Frog Green
#89C35C Green Peas
#85BB65 Dollar Bill Green
#8BB381 Dark Sea Green
#9CB071 Iguana Green
#B2C248 Avocado Green
#9DC209 Pistachio Green
#A1C935 Salad Green
#7FE817 Hummingbird Green
#59E817 Nebula Green
#57E964 Stoplight Go Green
#64E986 Algae Green
#5EFB6E Jade Green
#00FF00 Green
#5FFB17 Emerald Green
#87F717 Lawn Green
#8AFB17 Chartreuse
#6AFB92 Dragon Green
#98FF98 Mint green
#B5EAAA Green Thumb
#C3FDB8 Light Jade
#CCFB5D Tea Green
#B1FB17 Green Yellow
#BCE954 Slime Green
#EDDA74 Goldenrod
#EDE275 Harvest Gold
#FFE87C Sun Yellow

4. Nama Warna HTML Kuning

Kuning boleh digunakan untuk menetapkan mood yang tidak serius, menunjukkan kreativiti dan keyakinan dalam halaman. Perlu diingat bahawa kuning berfungsi lebih baik sebagai latar belakang berbanding warna teks.

#FFFF00 Yellow
#FFF380 Corn Yellow
#FFFFC2 Parchment
#FFFFCC Cream
#FFF8C6 Lemon Chiffon
#FFF8DC Cornsilk
#F5F5DC Beige
#FBF6D9 Blonde
#FAEBD7 AntiqueWhite
#F7E7CE Champagne
#FFEBCD BlanchedAlmond
#F3E5AB Vanilla
#ECE5B6 Tan Brown
#FFE5B4 Peach
#FFDB58 Mustard
#FFD801 Rubber Ducky Yellow
#FDD017 Bright Gold
#EAC117 Golden brown
#F2BB66 Macaroni and Cheese
#FBB917 Saffron
#FBB117 Beer
#FFA62F Cantaloupe
#E9AB17 Bee Yellow

5. Warna HTML Coklat

Latar belakang coklat boleh menyukarkan membaca teks putih atau hitam, anda boleh menggunakan warna lain yang mempunyai kontras yang baik terhadap warna coklat anda.

#E2A76F Brown Sugar
#DEB887 BurlyWood
#FFCBA4 Deep Peach
#C9BE62 Ginger Brown
#E8A317 School Bus Yellow
#EE9A4D Sandy Brown
#C8B560 Fall Leaf Brown
#D4A017 Orange Gold
#C2B280 Sand
#C7A317 Cookie Brown
#C68E17 Caramel
#B5A642 Brass
#ADA96E Khaki
#C19A6B Camel brown
#CD7F32 Bronze
#C88141 Tiger Orange
#C58917 Cinnamon
#AF9B60 Bullet Shell
#AF7817 Dark Goldenrod
#B87333 Copper
#966F33 Wood
#806517 Oak Brown
#827839 Moccasin
#827B60 Army Brown
#786D5F Sandstone
#493D26 Mocha
#483C32 Taupe
#6F4E37 Coffee
#835C3B Brown Bear
#7F5217 Red Dirt
#7F462C Sepia

6. Warna HTML Jingga

Oren berfungsi dengan baik untuk menyerlahkan titik apabila warna digunakan sebagai latar belakang dan ia boleh membangkitkan perasaan semangat dan kemesraan tanpa menjadi terlalu norak.6. Warna HTML Jingga

#C47451 Orange Salmon
#C36241 Rust
#C35817 Red Fox
#C85A17 Chocolate
#CC6600 Sedona
#E56717 Papaya Orange
#E66C2C Halloween Orange
#F87217 Pumpkin Orange
#F87431 Construction Cone Orange
#E67451 Sunrise Orange
#FF8040 Mango Orange
#F88017 Dark Orange
#FF7F50 Coral
#F88158 Basket Ball Orange
#F9966B Light Salmon
#E78A61 Tangerine
#E18B6B Dark Salmon
#E77471 Light Coral
#F75D59 Bean Red
#E55451 Valentine Red
#E55B3C Shocking Orange

7. Kod Warna HTML Merah

Bagi sesetengah pelayar, teks bergaris merah digunakan sebagai pautan yang dilawati, anda harus mengelak daripada menggunakannya untuk tidak mengelirukan pelawat.

#FF0000 Red
#FF2400 Scarlet
#F62217 Ruby Red
#F70D1A Ferrari Red
#F62817 Fire Engine Red
#E42217 Lava Red
#E41B17 Love Red
#DC381F Grapefruit
#C34A2C Chestnut Red
#C24641 Cherry Red
#C04000 Mahogany
#C11B17 Chilli Pepper
#9F000F Cranberry
#990012 Red Wine
#8C001A Burgundy
#954535 Chestnut
#7E3517 Blood Red
#8A4117 Sienna
#7E3817 Sangria
#800517 Firebrick
#810541 Maroon
#7D0541 Plum Pie
#7E354D Velvet Maroon
#7D0552 Plum Velvet
#7F4E52 Rosy Finch
#7F5A58 Puce
#7F525D Dull Purple
#B38481 Rosy Brown
#C5908E Khaki Rose

8. Kod Warna HTML Merah Jambu

Menurut sains warna, Pink dan ronanya boleh digunakan jika anda mahu pelawat mempunyai perasaan yakin, kecanggihan dan kemesraan di bawah sedar mereka.

#C48189 Pink Bow
#C48793 Lipstick Pink
#E8ADAA Rose
#ECC5C0 Rose Gold
#EDC9AF Desert Sand
#FDD7E4 Pig Pink
#FCDFFF Cotton Candy
#FFDFDD Pink Bubble Gum
#FBBBB9 Misty Rose
#FAAFBE Pink
#FAAFBA Light Pink
#F9A7B0 Flamingo Pink
#E7A1B0 Pink Rose
#E799A3 Pink Daisy
#E38AAE Cadillac Pink
#F778A1 Carnation Pink
#E56E94 Blush Red
#F660AB Hot Pink
#FC6C85 Watermelon Pink
#F6358A Violet Red
#F52887 Deep Pink
#E45E9D Pink Cupcake
#E4287C Pink Lemonade
#F535AA Neon Pink
#FF00FF Magenta
#E3319D Dimorphotheca Magenta
#F433FF Bright Neon Pink
#D16587 Pale Violet Red
#C25A7C Tulip Pink
#CA226B Medium Violet Red
#C12869 Rogue Pink
#C12267 Burnt Pink
#C25283 Bashful Pink
#C12283 Dark Carnation Pink
#B93B8F Plum

9. Kod Warna HTML Ungu dan Putih

Menggunakan warna Teks Putih dengan latar belakang Putih akan menjadikannya tidak boleh dibaca oleh pengguna dan selain daripada tidak mesra pengguna, anda boleh mendapat penalti SEO untuk tapak anda oleh itu, sentiasa gunakan warna putih dan warna terang lain pada latar belakang gelap.

#7E587E Viola Purple
#571B7E Purple Iris
#583759 Plum Purple
#4B0082 Indigo
#461B7E Purple Monster
#4E387E Purple Haze
#614051 Eggplant
#5E5A80 Grape
#6A287E Purple Jam
#7D1B7E Dark Orchid
#A74AC7 Purple Flower
#B048B5 Medium Orchid
#6C2DC7 Purple Amethyst
#842DCE Dark Violet
#8D38C9 Violet
#7A5DC7 Purple Sage Bush
#7F38EC Lovely Purple
#8E35EF Purple
#893BFF Aztech Purple
#8467D7 Medium Purple
#A23BEC Jasmine Purple
#B041FF Purple Daffodil
#C45AEC Tyrian Purple
#9172EC Crocus Purple
#9E7BFF Purple Mimosa
#D462FF Heliotrope Purple
#E238EC Crimson
#C38EC7 Purple Dragon
#C8A2C8 Lilac
#E6A9EC Blush Pink
#E0B0FF Mauve
#C6AEC7 Wisteria Purple
#F9B7FF Blossom Pink
#D2B9D3 Thistle
#E9CFEC Periwinkle
#EBDDE2 Lavender Pinocchio
#E3E4FA Lavender blue
#FDEEF4 Pearl
#FFF5EE SeaShell
#FEFCFF Milk White
#FFFFFF White

Beberapa Kod Warna HTML yang paling banyak digunakan

Ini adalah beberapa warna popular yang digunakan di web; Saya telah meletakkannya dalam jadual yang berasingan untuk mencarinya dengan cepat.

Red #FF0000 White #FFFFFF
Cyan #00FFFF Silver #C0C0C0
Blue #0000FF Gray or Grey #808080
DarkBlue #0000A0 Black #000000
LightBlue #ADD8E6 Orange #FFA500
Purple #800080 Brown #A52A2A
Yellow #FFFF00 Maroon #800000
Lime #00FF00 Green #008000
Magenta #FF00FF Olive #808000

Examples of Color Name in HTML

Let us see how color name in HTML is used with the help of some examples mentioned below:

Example #1

Let us consider a general example showing how example color name in HTML is going to be used:

HTML code:

<!DOCTYPE html>
<html>
<body>
<h1 style="color:Violet;">About Life.....</h1>
<h4 >Creativity Is Intelligence Having Fun </h4>
<p style="background-color: #00FFFF; color:blue">
ログイン後にコピー

You Learn More From Failure Than From Success. Don’t Let It Stop You. Failure Builds Character. If You Are Working On Something That You Really Care About, You Don’t Have To Be Pushed. The Vision Pulls You

</p>
</body>
</html>
ログイン後にコピー

Output:

HTMLでの色の名前

Example #2

Now we are taking another example which will define all types of HTML color as follows:

HTML code:

<!DOCTYPE html>
<html>
<body>
<h1 style="color:rgb(255, 0, 0);">RGB defines Red color</h1>
<h1 style="color:rgb(60, 60, 60);">RGB same values define Gray shade</h1>
<h1 style="background-color:#ffa500;">New color using Hex Value</h1>
<h1 style="background-color:#787878;">Shade of Gray</h1>
<h1 style="background-color:hsl(50, 100%, 50%);">hsl color shade</h1>
<h1 style="background-color:rgba(255, 99, 71, 0.4);">rgba color shade</h1>
<h1 style="color:hsla(9, 100%, 80%, 0.5);">hsla color shade</h1>
</body>
</html>
ログイン後にコピー

Output:

HTMLでの色の名前

In the above example, we are able to see the use of different HTML color types and how they are named in HTML.

Example #3

One more use of HTML color is to define a border to the element, which is as follows:

In Example, Here, we can add a border to your code body, changing the background and text colour.

HTML code:

<p style="border: 2px solid #A52A2A; background-color:#ffa500;color:#FFF8DC">Self-actualizing theory talks of intrinsic rewards inherent in the task performance such as job satisfaction, feeling of achievement, etc.</p>
ログイン後にコピー

Output:

HTMLでの色の名前

Conclusion

We came across that HTML colors are defined with different names, percentage value, Hex value, alpha value, and many more. Color name in HTML is used to do color for text, for background, for a border, for gradations. Different types define HTML color name as RGB, hex, hsl, rgba, hsla.

以上がHTMLでの色の名前の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

ソース:php
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
最新の問題
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!