diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
commit | 074785cea106179cb3305637055ab0a009ca74f2 (patch) | |
tree | e6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/pt-br/web/css/css_images | |
parent | da78a9e329e272dedb2400b79a3bdeebff387d47 (diff) | |
download | translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2 translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip |
initial commit
Diffstat (limited to 'files/pt-br/web/css/css_images')
-rw-r--r-- | files/pt-br/web/css/css_images/implementando_sprites_de_imagens_em_css/index.html | 47 | ||||
-rw-r--r-- | files/pt-br/web/css/css_images/index.html | 152 |
2 files changed, 199 insertions, 0 deletions
diff --git a/files/pt-br/web/css/css_images/implementando_sprites_de_imagens_em_css/index.html b/files/pt-br/web/css/css_images/implementando_sprites_de_imagens_em_css/index.html new file mode 100644 index 0000000000..e14ba15c2d --- /dev/null +++ b/files/pt-br/web/css/css_images/implementando_sprites_de_imagens_em_css/index.html @@ -0,0 +1,47 @@ +--- +title: Implementando sprites de imagens em CSS +slug: Web/CSS/CSS_Images/Implementando_sprites_de_imagens_em_CSS +translation_of: Web/CSS/CSS_Images/Implementing_image_sprites_in_CSS +--- +<div>{{cssRef}}</div> + +<p><strong>Sprites de imagens</strong> são utilizados em diversas aplicações web onde várias imagens são usadas. Ao invés de incluir cada arquivo de imagem separadamente, é mais amigável com a memória e largura de banda enviar tudo como uma única imagem, diminuindo o número de pedidos em HTTP.</p> + +<div class="note"> +<p><strong>Nota:</strong> Quando usando HTTP/2, é mais amigável com a largura de banda usar vários pequenos pedidos.</p> +</div> + +<h2 id="Implementação">Implementação</h2> + +<p>Suponha que uma imagem é dada a cada item com a classe <code>toolbtn</code>:</p> + +<pre class="brush:css">.toolbtn { + background: url(myfile.png); + display: inline-block; + height: 20px; + width: 20px; +}</pre> + +<p>A posição do plano de fundo pode ser adicionada tanto com dois valores x, y depois de {{cssxref("url()")}} em background , ou como {{cssxref("background-position")}} . Por exemplo:</p> + +<pre class="brush:css">#btn1 { + background-position: -20px 0px; +} + +#btn2 { + background-position: -40px 0px; +}</pre> + +<p>Isso vai mover o elemento com a ID 'btn1' 20 pixels para a esquerda e o elemento com a ID 'btn2' 40 pixels para a esquerda (presumindo que ambos tem a classe <code>toolbtn</code> atribuída e estão sendo afetados pela regra da imagem acima).</p> + +<p>De forma similar, você pode criar um efeito de hover com:</p> + +<pre class="brush:css">#btn:hover { + background-position: <var><pixels para direita></var>px <var><pixels para baixo></var>px; +}</pre> + +<h2 id="Veja_também">Veja também</h2> + +<ul> + <li><a href="http://css-tricks.com/snippets/css/perfect-css-sprite-sliding-doors-button/">Demo completa em CSS Tricks</a></li> +</ul> diff --git a/files/pt-br/web/css/css_images/index.html b/files/pt-br/web/css/css_images/index.html new file mode 100644 index 0000000000..b3e23ab194 --- /dev/null +++ b/files/pt-br/web/css/css_images/index.html @@ -0,0 +1,152 @@ +--- +title: CSS Images +slug: Web/CSS/CSS_Images +tags: + - CSS + - CSS Images + - NeedsTranslation + - Overview + - Reference + - TopicStub +translation_of: Web/CSS/CSS_Images +--- +<div>{{CSSRef}}</div> + +<p><strong>CSS Images</strong> is a module of CSS that defines what types of images can be used (the {{cssxref("<image>")}} type, containing URLs, gradients and other types of images), how to resize them and how they, and other replaced content, interact with the different layout models.</p> + +<h2 id="Reference">Reference</h2> + +<h3 id="Properties">Properties</h3> + +<div class="index"> +<ul> + <li>{{cssxref("image-orientation")}}</li> + <li>{{cssxref("image-rendering")}}</li> + <li>{{cssxref("object-fit")}}</li> + <li>{{cssxref("object-position")}}</li> +</ul> +</div> + +<h3 id="Functions">Functions</h3> + +<div class="index"> +<ul> + <li>{{cssxref("linear-gradient", "linear-gradient()")}}</li> + <li>{{cssxref("radial-gradient", "radial-gradient()")}}</li> + <li>{{cssxref("repeating-linear-gradient", "repeating-linear-gradient()")}}</li> + <li>{{cssxref("repeating-radial-gradient", "repeating-radial-gradient()")}}</li> + <li>{{cssxref("element", "element()")}}</li> +</ul> +</div> + +<h3 id="Data_types">Data types</h3> + +<div class="index"> +<ul> + <li>{{cssxref("<gradient>")}}</li> + <li>{{cssxref("<image>")}}</li> +</ul> +</div> + +<h2 id="Guides">Guides</h2> + +<dl> + <dt><a href="/en-US/docs/Web/CSS/CSS_Images/Using_CSS_gradients">Using CSS gradients</a></dt> + <dd>Presents a specific type of CSS images, <em>gradients</em>, and how to create and use these.</dd> + <dt><a href="/en-US/docs/Web/CSS/CSS_Images/Implementing_image_sprites_in_CSS">Implementing image sprites in CSS</a></dt> + <dd>Describes the common technique grouping several images in one single document to save download requests and speed up the availability of a page.</dd> +</dl> + +<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('CSS4 Images')}}</td> + <td>{{Spec2('CSS4 Images')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('CSS3 Images')}}</td> + <td>{{Spec2('CSS3 Images')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('Compat', '#css-%3Cimage%3E-type', 'CSS Gradients')}}</td> + <td>{{Spec2('Compat')}}</td> + <td>Standardizes the <code>-webkit</code> prefixed gradient value functions</td> + </tr> + <tr> + <td>{{SpecName('CSS3 Values', '#urls', '<url>')}}</td> + <td>{{Spec2('CSS3 Values')}}</td> + <td> </td> + </tr> + <tr> + <td>{{Specname('CSS2.1', 'syndata.html#uri', '<uri>')}}</td> + <td>{{Spec2('CSS2.1')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('CSS1', '#url', '<url>')}}</td> + <td>{{Spec2('CSS1')}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari (WebKit)</th> + </tr> + <tr> + <td>Basic support</td> + <td>1.0</td> + <td>{{CompatGeckoDesktop("1")}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>1.0</td> + <td>{{CompatGeckoMobile("1")}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> |