Câu hỏi phỏng vấn HTML
Câu hỏi

How do you change the direction of html text?

Câu trả lời

To change the direction of HTML text, you can use the dir attribute in your HTML markup or the direction property in CSS.

Using the HTML dir attribute:

The dir attribute can be applied to HTML elements to specify the text direction. It accepts the following values:

  • ltr: Left-to-right text direction, which is the default for languages like English.
  • rtl: Right-to-left text direction, used for languages such as Arabic and Hebrew.
  • auto: The browser automatically determines the text direction based on the content.

For example, to set a paragraph to display text from right to left, you would write:

html Copy
<p dir="rtl">This text will be displayed from right to left.</p>

Using the CSS direction property:

Alternatively, you can use the CSS direction property to set the direction of text within a block-level element:

  • ltr: Specifies that text direction goes from left to right.
  • rtl: Specifies that text direction goes from right to left.
  • inherit: Inherits the direction from its parent element.

Here's how you can apply it in CSS:

css Copy
p {
  direction: rtl;
}

And in your HTML:

html Copy
<p>This text will be displayed from right to left.</p>

It's important t...

middle

middle

Gợi ý câu hỏi phỏng vấn

junior

What is the difference between span and div?

senior

Why to use HTML5 semantic tags?

middle

What is HTML5 Web Storage? Explain localStorage and sessionStorage .

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào