CSS - cunhapaulo/Referencecard GitHub Wiki
- Código:
img[alt~="center"] {
display: block;
margin: 0 auto;
}
- Exemplo de uso:

- Código:
<style>
.texto-italico-amarelo {
font-style: italic;
color: yellow;
}
</style>
- Exemplo de uso:
<p>Este texto não está estilizado.
<span class="texto-italico-amarelo">
Este texto está em itálico e amarelo
</span> e este texto novamente não está estilizado.
</p>
- Código:
<style>
i {
font-style: normal; /* Remove o itálico */
color: green; /* Define a cor do texto como verde */
}
i.destaque {
font-weight: bold; /* Deixa o texto em negrito */
}
</style>
- Exemplo de uso:
<p>Este é um texto normal.</p>
<i>Este texto está em itálico (padrão).</i>
<p>Este é outro texto normal.</p>
<i class="destaque">Este texto em itálico está em negrito.</i>
<p>Este é outro texto normal.</p>
<i>Este texto em itálico é verde.</i>
https://www.cdnfonts.com/oak-sans.font
- Start by defining the
@font-face
rule and give it a name. Inside the rule, specify thefont-family
property with the desired name for your font.
@font-face {
font-family: MyCustomFont;
}
- Specify the source of the font file using the
src
property. You can provide the path to a local font file or a URL to a font hosted online. Make sure to include different file formats to support cross-browser compatibility.
@font-face {
font-family: MyCustomFont;
src: url('path/to/font.ttf') format('truetype'),
url('path/to/font.woff') format('woff'),
url('path/to/font.eot') format('embedded-opentype');
}
- Once you have defined the
@font-face
rule, you can use the specifiedfont-family
name in your CSS styles to apply the embedded font to specific elements.
body {
font-family: MyCustomFont, Arial, sans-serif;
}
In this example, the font specified in the @font-face rule will be applied to the body element, and if the font is not available, it will fallback to Arial and then to a generic sans-serif font.