Làm sao để căn cho khối text nằm yên trên img khi co giãn màn hình


mọi người cho mình hỏi, làm thế nào để khối text luôn nằm trong cái vệt trắng kia khi mình co giãn mọi kích thước màn hình nhỉ :frowning: mình mới học. Xin chân thành cảm ơn !!!

Cách 1. Chèn chữ vào ảnh luôn,
Xong cách 1 mình thử tìm google: ‘font-size responsive’
Cách 2. Để font-size ở đơn vị vw: viewport width

<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<body>

<h1 style="font-size:10vw;">Responsive Text</h1>

<p style="font-size:5vw;">Resize the browser window to see how the text size scales.</p>

<p style="font-size:5vw;">Use the "vw" unit when sizing the text. 10vw will set the size to 10% of the viewport width.</p>

<p>Viewport is the browser window size. 1vw = 1% of viewport width. If the viewport is 50cm wide, 1vw is 0.5cm.</p>

</body>
</html>

https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_responsive_text

5 Likes

okay Mình cảm ơn nhé <3

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?