aboutsummaryrefslogtreecommitdiff
path: root/files/id/web/css/background-color
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:17 -0500
commitda78a9e329e272dedb2400b79a3bdeebff387d47 (patch)
treee6ef8aa7c43556f55ddfe031a01cf0a8fa271bfe /files/id/web/css/background-color
parent1109132f09d75da9a28b649c7677bb6ce07c40c0 (diff)
downloadtranslated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.gz
translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.bz2
translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.zip
initial commit
Diffstat (limited to 'files/id/web/css/background-color')
-rw-r--r--files/id/web/css/background-color/index.html149
1 files changed, 149 insertions, 0 deletions
diff --git a/files/id/web/css/background-color/index.html b/files/id/web/css/background-color/index.html
new file mode 100644
index 0000000000..920b4d28e5
--- /dev/null
+++ b/files/id/web/css/background-color/index.html
@@ -0,0 +1,149 @@
+---
+title: background-color
+slug: Web/CSS/background-color
+translation_of: Web/CSS/background-color
+---
+<div>{{CSSRef}}</div>
+
+<p><strong><code>Background-color</code></strong> <a href="/en-US/docs/Web/CSS">CSS</a> digunakan untuk seting warna latar belakang dari element yang di inginkan.</p>
+
+<div>{{EmbedInteractiveExample("pages/css/background-color.html")}}</div>
+
+
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="brush: css no-line-numbers">/* Keyword values */
+background-color: red;
+background-color: indigo;
+
+/* Hexadecimal value */
+background-color: #bbff00; /* Fully opaque */
+background-color: #11ffee00; /* Fully transparent */
+background-color: #11ffeeff; /* Fully opaque */
+
+/* RGB value */
+background-color: rgb(255, 255, 128); /* Fully opaque */
+background-color: rgba(117, 190, 218, 0.5); /* 50% transparent */
+
+/* HSL value */
+background-color: hsl(50, 33%, 25%); /* Fully opaque */
+background-color: hsla(50, 33%, 25%, 0.75); /* 75% transparent */
+
+/* Special keyword values */
+background-color: currentcolor;
+background-color: transparent;
+
+/* Global values */
+background-color: inherit;
+background-color: initial;
+background-color: unset;</pre>
+
+<p><code>Background-color</code> menggunakan hanya satu jenis warna <code><a href="#&lt;color>">&lt;color&gt;</a></code> nilai.</p>
+
+<h3 id="Values">Values</h3>
+
+<dl>
+ <dt><a id="&lt;color>"></a>{{cssxref("&lt;color&gt;")}}</dt>
+ <dd>The uniform color of the background. It is rendered behind any {{cssxref("background-image")}} that is specified, although the color will still be visible through any transparency in the image.</dd>
+</dl>
+
+<h3 id="Formal_syntax">Formal syntax</h3>
+
+<pre class="syntaxbox">{{csssyntax}}</pre>
+
+<h2 id="Contoh">Contoh</h2>
+
+<h3 id="HTML">HTML</h3>
+
+<pre class="brush: html">&lt;div class="exampleone"&gt;
+ Lorem ipsum dolor sit amet, consectetuer
+&lt;/div&gt;
+
+&lt;div class="exampletwo"&gt;
+ Lorem ipsum dolor sit amet, consectetuer
+&lt;/div&gt;
+
+&lt;div class="examplethree"&gt;
+ Lorem ipsum dolor sit amet, consectetuer
+&lt;/div&gt;</pre>
+
+<h3 id="CSS">CSS</h3>
+
+<pre class="brush: css; highlight:[2,7,12];">.exampleone {
+ background-color: teal;
+ color: white;
+}
+
+.exampletwo {
+ background-color: rgb(153,102,153);
+ color: rgb(255,255,204);
+}
+
+.examplethree {
+ background-color: #777799;
+ color: #FFFFFF;
+}
+</pre>
+
+<h3 id="Result">Result</h3>
+
+<p>{{EmbedLiveSample("Examples", 200, 150)}}</p>
+
+<h2 id="Accessibility_concerns">Accessibility concerns</h2>
+
+<p>It is important to ensure that the contrast ratio between the background color and the color of the text placed over it is high enough that people experiencing low vision conditions will be able to read the content of the page.</p>
+
+<p>Color contrast ratio is determined by comparing the luminosity of the text and background color values. In order to meet current <a href="https://www.w3.org/WAI/intro/wcag">Web Content Accessibility Guidelines (WCAG)</a>, a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. Large text is defined as 18.66px and <a href="/en-US/docs/Web/CSS/font-weight">bold</a> or larger, or 24px or larger.</p>
+
+<ul>
+ <li><a href="https://webaim.org/resources/contrastchecker/">WebAIM: Color Contrast Checker</a></li>
+ <li><a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable#Guideline_1.4_Make_it_easier_for_users_to_see_and_hear_content_including_separating_foreground_from_background">MDN Understanding WCAG, Guideline 1.4 explanations</a></li>
+ <li><a href="https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html">Understanding Success Criterion 1.4.3  | W3C Understanding WCAG 2.0</a></li>
+</ul>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('CSS3 Backgrounds', '#background-color', 'background-color')}}</td>
+ <td>{{Spec2('CSS3 Backgrounds')}}</td>
+ <td>Though technically removing the <code>transparent</code> keyword, this doesn't change anything as it has been incorporated as a true {{cssxref("&lt;color&gt;")}}</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('CSS2.1', 'colors.html#propdef-background-color', 'background-color')}}</td>
+ <td>{{Spec2('CSS2.1')}}</td>
+ <td>No change</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('CSS1', '#background-color', 'background-color')}}</td>
+ <td>{{Spec2('CSS1')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<div>{{cssinfo}}</div>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("css.properties.background-color")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/CSS/CSS_Background_and_Borders/Using_CSS_multiple_backgrounds">Multiple backgrounds</a></li>
+ <li>The {{cssxref("&lt;color&gt;")}} data type</li>
+ <li>Other color-related properties: {{cssxref("color")}}, {{cssxref("border-color")}}, {{cssxref("outline-color")}}, {{cssxref("text-decoration-color")}}, {{cssxref("text-emphasis-color")}}, {{cssxref("text-shadow")}}, {{cssxref("caret-color")}}, and {{cssxref("column-rule-color")}}</li>
+ <li><a href="/en-US/docs/Web/HTML/Applying_color">Applying color to HTML elements using CSS</a></li>
+</ul>