From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- files/pt-pt/learn/css/estilo_de_texto/index.html | 136 +++++++++++++ files/pt-pt/learn/css/howto/faq_de_css/index.html | 229 ++++++++++++++++++++++ files/pt-pt/learn/css/howto/index.html | 93 +++++++++ files/pt-pt/learn/css/index.html | 59 ++++++ 4 files changed, 517 insertions(+) create mode 100644 files/pt-pt/learn/css/estilo_de_texto/index.html create mode 100644 files/pt-pt/learn/css/howto/faq_de_css/index.html create mode 100644 files/pt-pt/learn/css/howto/index.html create mode 100644 files/pt-pt/learn/css/index.html (limited to 'files/pt-pt/learn/css') diff --git a/files/pt-pt/learn/css/estilo_de_texto/index.html b/files/pt-pt/learn/css/estilo_de_texto/index.html new file mode 100644 index 0000000000..5d00bc90c5 --- /dev/null +++ b/files/pt-pt/learn/css/estilo_de_texto/index.html @@ -0,0 +1,136 @@ +--- +title: Estilizar texto +slug: Learn/CSS/Estilo_de_texto +tags: + - CSS + - Hiperligações + - Principiante + - Texto + - Tipos de Letra + - letra + - lina + - listas + - modulo + - sombra + - tipo de letra + - tipos de letra da Web +translation_of: Learn/CSS/Styling_text +--- +
{{LearnSidebar}}
+ +

Com os conceitos básicos da linguagem CSS cobertos, o próximo tópico de CSS para se concentrar será o estilo de texto - uma das coisas mais comuns que irá fazer com CSS. Aqui, nós vamos ver os fundamentos do estilo de texto, incluindo a configuração do tipo de letra, negrito, itálico, espaçamento de linha e letra, sombras e outros recursos de texto. Nós completamos o módulo ao analisar a aplicação de tipos de letra personalizadas para a sua página, e listas de estilo e hiperligações.

+ +

Pré-requisitos

+ +

Before starting this module, you should already have basic familiarity with HTML, as discussed in the Introduction to HTML module, and be comfortable with CSS fundamentals, as discussed in Introduction to CSS.

+ +
+

Nota: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin, CodePen or Thimble.

+
+ +

Guias

+ +

This module contains the following articles, which will teach you all of the essentials behind styling HTML text content.

+ +
+
Fundamental text and font styling
+
In this article we go through all the basics of text/font styling in detail, including setting font weight, family and style, font shorthand, text alignment and other effects, and line and letter spacing.
+
Styling lists
+
Lists behave like any other text for the most part, but there are some CSS properties specific to lists that you need to know about, and some best practices to consider. This article explains all.
+
Styling links
+
When styling links, it is important to understand how to make use of pseudo-classes to style link states effectively, and how to style links for use in common varied interface features such as navigation menus and tabs. We'll look at all these topics in this article.
+
Web fonts
+
Here we will explore web fonts in detail — these allow you to download custom fonts along with your web page, to allow for more varied, custom text styling.
+
+ +

Avaliações

+ +

The following assessments will test your understanding of the text styling techniques covered in the guides above.

+ +
+
Typesetting a community school homepage
+
In this assessment we'll test your understanding of styling text by getting you to style the text for a community school's homepage.
+
+ +
+ + + + + +
diff --git a/files/pt-pt/learn/css/howto/faq_de_css/index.html b/files/pt-pt/learn/css/howto/faq_de_css/index.html new file mode 100644 index 0000000000..357e271657 --- /dev/null +++ b/files/pt-pt/learn/css/howto/faq_de_css/index.html @@ -0,0 +1,229 @@ +--- +title: Perguntas Frequentes sobre CSS +slug: Learn/CSS/Howto/FAQ_de_CSS +tags: + - CSS + - Exemplo + - FAQ + - Guía + - Web + - questões +translation_of: Learn/CSS/Howto/CSS_FAQ +--- +

Why doesn't my CSS, which is valid, render correctly?

+ +

Browsers use the DOCTYPE declaration to choose whether to show the document using a mode that is more compatible  with Web standards or with old browser bugs. Using a correct and modern DOCTYPE declaration at the start of your HTML will improve browser standards compliance.

+ +

Modern browsers have two main rendering modes:

+ + + +

Gecko-based browsers, have a third Almost Standards Mode that has only a few minor quirks.

+ +

This is a list of the most commonly used DOCTYPE declarations that will trigger Standards or Almost Standards mode:

+ +
<!DOCTYPE html> /* This is the HTML5 doctype. Given that each modern browser uses an HTML5
+                   parser, this is the recommended doctype */
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+"http://www.w3.org/TR/html4/strict.dtd">
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+ +

When at all possible, you should just use the HTML5 doctype.

+ +

Why doesn't my CSS, which is valid, render at all?

+ +

Here are some possible causes:

+ + + +

What is the difference between id and class?

+ +

HTML elements can have an id and/or class attribute. The id attribute assigns a name to the element it is applied to, and for valid markup, there can be only one element with that name. The class attribute assigns a class name to the element, and that name can be used on many elements within the page. CSS allows you to apply styles to particular id and/or class names.

+ + + +

It is generally recommended to use classes as much as possible, and to use ids only when absolutely necessary for specific uses (like to connect label and form elements or for styling elements that must be semantically unique):

+ + + +
+

Note: See Selectors for more information.

+
+ +

How do I restore the default value of a property?

+ +

Initially CSS didn't provide a "default" keyword and the only way to restore the default value of a property is to explicitly re-declare that property. For example:

+ +
/* Heading default color is black */
+h1 { color: red; }
+h1 { color: black; }
+ +

This has changed with CSS 2; the keyword initial is now a valid value for a CSS property. It resets it to its default value, which is defined in the CSS specification of the given property.

+ +
/* Heading default color is black */
+h1 { color: red; }
+h1 { color: initial; }
+ +

How do I derive one style from another?

+ +

CSS does not exactly allow one style to be defined in terms of another. (See Eric Meyer's note about the Working Group's stance). However, assigning multiple classes to a single element can provide the same effect, and CSS Variables now provide a way to define style information in one place that can be reused in multiple places.

+ +

How do I assign multiple classes to an element?

+ +

HTML elements can be assigned multiple classes by listing the classes in the class attribute, with a blank space to separate them.

+ +
<style type="text/css">
+.news { background: black; color: white; }
+.today { font-weight: bold; }
+</style>
+
+<div class="news today">
+... content of today's news ...
+</div>
+
+ +

If the same property is declared in both rules, the conflict is resolved first through specificity, then according to the order of the CSS declarations. The order of classes in the class attribute is not relevant.

+ +

Why don't my style rules work properly?

+ +

Style rules that are syntactically correct may not apply in certain situations. You can use DOM Inspector's CSS Style Rules view to debug problems of this kind, but the most frequent instances of ignored style rules are listed below.

+ +

HTML elements hierarchy

+ +

The way CSS styles are applied to HTML elements depends also on the elements hierarchy. It is important to remember that a rule applied to a descendent overrides the style of the parent, in spite of any specificity or priority of CSS rules.

+ +
.news { color: black; }
+.corpName { font-weight: bold; color: red; }
+
+<!-- news item text is black, but corporate name is red and in bold -->
+<div class="news">
+   (Reuters) <span class="corpName">General Electric</span> (GE.NYS) announced on Thursday...
+</div>
+
+ +

In case of complex HTML hierarchies, if a rule seems to be ignored, check if the element is inside another element with a different style.

+ +

Explicitly re-defined style rule

+ +

In CSS stylesheets, order is important. If you define a rule and then you re-define the same rule, the last definition is used.

+ +
#stockTicker { font-weight: bold; }
+.stockSymbol { color: red; }
+/*  other rules             */
+/*  other rules             */
+/*  other rules             */
+.stockSymbol { font-weight: normal; }
+
+<!-- most text is in bold, except "GE", which is red and not bold -->
+<div id="stockTicker">
+   NYS: <span class="stockSymbol">GE</span> +1.0 ...
+</div>
+
+ +

To avoid this kind of error, try to define rules only once for a certain selector, and group all rules belonging to that selector.

+ +

Use of a shorthand property

+ +

Using shorthand properties for defining style rules is good because it uses a very compact syntax. Using shorthand with only some attributes is possible and correct, but it must be remembered that undeclared attributes are automatically reset to their default values. This means that a previous rule for a single attribute could be implicitly overridden.

+ +
#stockTicker { font-size: 12px; font-family: Verdana; font-weight: bold; }
+.stockSymbol { font: 14px Arial; color: red; }
+
+<div id="stockTicker">
+   NYS: <span class="stockSymbol">GE</span> +1.0 ...
+</div>
+
+ +

In the previous example the problem occurred on rules belonging to different elements, but it could happen also for the same element, because rule order is important.

+ +
#stockTicker {
+   font-weight: bold;
+   font: 12px Verdana;  /* font-weight is now set to normal */
+}
+
+ +

Use of the * selector

+ +

The * wildcard selector refers to any element, and it has to be used with particular care.

+ +
body * { font-weight: normal; }
+#stockTicker { font: 12px Verdana; }
+.corpName { font-weight: bold; }
+.stockUp { color: red; }
+
+<div id="section">
+   NYS: <span class="corpName"><span class="stockUp">GE</span></span> +1.0 ...
+</div>
+
+ +

In this example the body * selector applies the rule to all elements inside body, at any hierarchy level, including the .stockUp class. So font-weight: bold; applied to the .corpName class is overridden by font-weight: normal; applied to all elements in the body.

+ +

The use of the * selector should be minimized as it is a slow selector, especially when not used as the first element of a selector. Its use should be avoided as much as possible.

+ +

Specificity in CSS

+ +

When multiple rules apply to a certain element, the rule chosen depends on its style specificity. Inline style (in HTML style attributes) has the highest specificity and will override any selectors, followed by ID selectors, then class selectors, and eventually element selectors. The text color of the below {{htmlelement("div")}} will therefore be red.

+ +
div { color: black; }
+#orange { color: orange; }
+.green { color: green; }
+
+<div id="orange" class="green" style="color: red;">This is red</div>
+
+ +

The rules are more complicated when the selector has multiple parts. More detailed information about how selector specificity is calculated can be found in the CSS 2.1 Specification chapter 6.4.3.

+ +

What do the -moz-*, -ms-*, -webkit-*, -o-* and -khtml-* properties do?

+ +

These properties, called prefixed properties, are extensions to the CSS standard. They allow use of experimental and non-standard features in browsers without polluting the regular namespace, preventing future incompatibilities to arise when the standard is extended.

+ +

The use of such properties on production websites is not recommended — they have already created a huge web compatibility mess. For example, many developers only using the -webkit- prefixed version of a property when the non-prefixed version is supported across all browsers meant that a feature relying on that property would break in non-webkit-based browsers, completely needlessly. This problem got so bad that other browsers started to implement -webkit- prefixed aliases to improve web compatibility, as specified in the Compatibility Living Standard.

+ +

In fact most browsers now do not use CSS prefixes when implementing experimental features, insteading implementing those features only on Nightly browser versions or similar.

+ +

If you need to use prefixes in your work, you are advised to write your code in a way that uses the prefixed versions first, but then includes a non-prefixed standard version afterwards so it can automatically override the prefixed versions where supported. For example:

+ +
-ms-transform: rotate(90deg);
+-webkit-transform: rotate(90deg);
+transform: rotate(90deg);
+ +
+

Note: For more information on dealing with prefixed properties, see Handling common HTML and CSS problems — Handling CSS prefixes from our Cross-browser testing module.

+
+ +
+

Note: See the Mozilla CSS Extensions page for more information on the Mozilla-prefixed CSS properties.

+
+ +

How does z-index relate to positioning?

+ +

The z-index property specifies the stack order of elements.

+ +

An element with a higher z-index/stack order is always rendered in front of an element with a lower z-index/stack order on the screen. Z-index will only work on elements that have a specified position (position:absolute, position:relative, or position:fixed).

+ +
+

Nota: For more information, see our Positioning learning article, and in particular the Introducing z-index section.

+
diff --git a/files/pt-pt/learn/css/howto/index.html b/files/pt-pt/learn/css/howto/index.html new file mode 100644 index 0000000000..ac198b7ae9 --- /dev/null +++ b/files/pt-pt/learn/css/howto/index.html @@ -0,0 +1,93 @@ +--- +title: Utilizar CSS para resolver problemas comuns +slug: Learn/CSS/Howto +tags: + - Aprendizagem + - CSS + - Learn + - NeedsTranslation + - Precisa de Tradução + - Principiante +translation_of: Learn/CSS/Howto +--- +
{{LearnSidebar}}
+ +

As seguintes hiperligações apontam para soluções até aos problemas comuns diários que irá precisar de resolver com CSS.

+ +

Casos de utilização comuns

+ +
+ + + +
+ +

Técninas avançadas e invulgares

+ +

Beyond the basics, CSS is allows very advanced design techniques. These articles help you tackle the hardest use cases you may face.

+ +

Geral

+ + + +

Efeitos avançados

+ + + +

Layout

+ + + +

Consultar também

+ +

CSS - Perguntas Frequentes (FAQ) — Uma coleção de pequenas partes de informação, abrangendo uma variedade de tópicos, desde a depuração até à utilização do seletor.

diff --git a/files/pt-pt/learn/css/index.html b/files/pt-pt/learn/css/index.html new file mode 100644 index 0000000000..eee5fb752a --- /dev/null +++ b/files/pt-pt/learn/css/index.html @@ -0,0 +1,59 @@ +--- +title: 'Aprender a estilizar HTML, utilizando CSS' +slug: Learn/CSS +tags: + - CSS + - Depuração + - Estilo + - Principiante + - Tópico + - especificidade +translation_of: Learn/CSS +--- +
{{LearnSidebar}}
+ +

Folhas de Estilo em Cascata — ou {{glossary("CSS")}} — é a segunda tecnologia que deveria começar a aprender depois de {{glossary("HTML")}}. Considerando que HTML é utilizado para definir a estrutura e semântica do seu conteúdo, CSS é utilizada para estilizar e aplicar. Assim, por exemplo, pode utilizar CSS para alterar o tipo de letra, cor, tamanho e espaçamento de seu conteúdo, dividi-lo em várias colunas, ou adicionar animações e outros elementos decorativos.

+ +

Passos de aprendizagem

+ +

Você deve aprender o básico de HTML antes de tentar qualquer CSS. Recomendamos que você trabalhe primeiro através do nosso módulo de Introdução ao HTML. Nesse módulo, você aprenderá sobre:

+ + + +

Uma vez entendidos os fundamentos do HTML, recomendamos que aprenda HTML e CSS ao mesmo tempo, andando para trás e para a frente entre os dois tópicos. Isto porque HTML é muito mais interessante com CSS, e você não pode realmente aprender CSS sem conhecer HTML.

+ +

Antes de iniciar este tópico, deve também estar familiarizado com a utilização de computadores e o uso da web passivamente (ou seja, apenas olhando para ele, consumindo o conteúdo). Você deve ter um ambiente de trabalho básico configurado conforme detalhado em Instalar software básico, e entender como criar e gerir arquivos, conforme detalhado em Lidar com ficheiros - ambos são partes do nosso módulo Primeiros passos na Web.

+ +

Recomenda-se que trabalhe através de Primeiros passos na Web antes de prosseguir com este tópico. No entanto, fazê-lo não é absolutamente necessário, pois muito do que é abordado no artigo CSS - Essencial também é abordado no nosso módulo CSS first steps, embora com muito mais detalhe.

+ +

Módulos

+ +

Este tópico contém os seguintes módulos, numa ordem sugerida para trabalhar com eles. Deveria definitivamente começar com o primeiro .

+ +
+
Introdução à CSS
+
This module gets you started with the basics of how CSS works, including selectors and properties, writing CSS rules, applying CSS to HTML, how to specify length, color, and other units in CSS, cascade and inheritance, box model basics, and debugging CSS.
+
Estilio de texto
+
Here we look at text styling fundamentals, including setting font, boldness, and italics, line and letter spacing, and drop shadows and other text features. We round off the module by looking at applying custom fonts to your page, and styling lists and links.
+
Estilio de caixas
+
Next up, we look at styling boxes, one of the fundamental steps towards laying out a web page. In this module we recap the box model then look at controlling box layouts by setting padding, borders and margins, setting custom background colors, images and other features, and fancy features such drop shadows and filters on boxes.
+
Disposição de CSS
+
At this point we've already looked at CSS fundamentals, how to style text, and how to style and manipulate the boxes that your content sits inside. Now it's time to look at how to place your boxes in the right place in relation to the viewport, and one another. We have covered the necessary prerequisites so can now dive deep into CSS layout, looking at different display settings, traditional layout methods involving float and positioning, and new fangled layout tools like flexbox.
+
Desenho responsivo (TBD)
+
Com tantos tipos diferentes de dispositivos capazes de navegar na Web nestes dias, o desenho da Web responsivo (RWD) tornou-se uma habilidade básica de desenvolvimento da Web. Este módulo irá abranger os princípios básicos e as ferramentas de RWD, explicar como aplicar CSS diferentes em um documento, dependendo das funcionalidades do dispositivo, como largura, orientação e resolução do ecrã, e explorar as tecnologias disponíveis para servir diferentes vídeos e imagens dependendo de tais funcionalidades.
+
+ +

Resolver problemas de CSS comuns

+ +

Utilizar CSS para resolver problemas comuns, fornece hioperligações para secções de conteúdo explicando como utilizar o CSS para resolver problemas muito comuns quando criar uma página da Web .

+ +

Consulte também

+ +
+
CSS na MDN
+
O ponto de entrada principal para a documentação de CSS na MDN, onde irá encontrar uma documentação de referência detalhada para todas as funcionalidades as linguagem CSS. Quer saber todos os valores que uma propriedade pode ter? Este é um bom lugar para ir.
+
-- cgit v1.2.3-54-g00ecf