我創建了一個HTML頁面,我想讓它響應。 我已經看過了w3schools,但沒有弄清楚如何使它響應。 我剛剛添加該行如何使我的HTML頁面響應?
<meta name=viewport content="width=device-width, initial-scale=1">
但它不會使文本響應。我知道我必須添加一些東西,但無法弄清楚什麼。
這裏是我的代碼:
<!doctype html>
<title>Test page</title>
<head>
<meta name=viewport content="width=device-width, initial-scale=1">
<style>
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; background: #eaeaea;text-align: center; padding: 150px;}
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
</head>
<article>
<h1>This is a test page</h1>
<div>
<p>
Test page that I made for fun. I would like to be able to code. <a href="mailto:#">Send me an email (not working)</a></p>
<p>— Alessio</p>
</div>
</article>
編輯:
目前我正在玩線
<meta name=viewport content="width=device-width, initial-scale=1">
- 沒有這一行,整個文本適合在移動設備,但非常小。所以頁面縮小以適應屏幕。
- 隨着線條,文字是一個很好的大小,但它不適合屏幕。
我需要的東西,以便我可以保持文本大小,但使其適合取決於屏幕尺寸。
我不想使用庫。我想直接在頁面中編寫代碼(如果可能的話)。
編輯2: 繼@elhampour和@gavgrif的建議我已經調查了更多的bootstrap。我正在freecodecamp.com上學習一門課程,現在我對這個建議有了更多的瞭解。 目前的代碼是
<!doctype html>
<title>Coming Soon</title>
<head>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"/>
</head>
<div class="container-fluid">
<h1 class="text-primary text-center">We’ll be online soon!</h1>
<img class="img-responsive col-sm-6 col-md-4 col-lg-3" src="https://livetogether.xyz/images/LT-header-alpha-flip.ico" alt="livetogether.xyz">
<p>If you need to you can always <a href="mailto:#">contact us</a>, we’ll get back to you shortly!</p>
<p>— LiveTogether Team</p>
</div>
現在我希望做響應
你可以使用引導框架,它是最知名的響應框架,也是我建議你先閱讀有關響應第一。 http://getbootstrap.com/ – elhampour