html - 使我的网站能够扩展到移动设备

标签 html css

尝试将我的网站扩展到移动设备,不允许我使用任何类型的框架。

我想在移动设备上以 block 的形式预览它?我该怎么做,因为我的文本会与我的图像混合,导航栏链接会变得困惑并在彼此之上滑动?

当屏幕变小时,我阅读了带有响应式导航栏的内容,使其成为汉堡菜单。

视口(viewport)设置为: <meta name="viewport" content="width=device-width, initial-scale=1">

* {
    padding: 0;
    margin: 0;
}
body, html {
    height: 100%;
    font-family: Camingo, sans-serif;
}

.bg {
    /* The image used */
    background-image: url("https://jackdijkema.000webhostapp.com/pics/skrrrt.jpg");
    /* Full height */
    height: 100%;
    /* Center and scale the image nicely */
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    position: relative;
}
.AboutMe {
    /* The image used */
    background-color: white;
    /* Full height */
    height: 50%;
    /* Center and scale the image nicely */
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    position: relative;
}
.Hoofdnav {
    font-family: Camingo, sans-serif;
    font-size: 25px;
    width: 100%;
    position: absolute;
    bottom: 100px;
    font-weight: 300;
}

.Hoofdnav li {
    display: inline-block;
    width: 33.3%;
    text-align: center;
}

.Hoofdnav ul {
    letter-spacing: 4px;
    list-style-type: none;
    margin: 0 auto;
    width: 30%;
}

.Hoofdnav a {
    color: white;
    text-decoration: none;
}
.Hoofdnav a:hover {
    font-weight: bold;
    text-outline: white 2px;
}
.AboutMe h1  {
    font-family: Camingo;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    margin-top: 3% ;
    text-transform: uppercase;
/*    text-decoration: underline;*/
    position:absolute;
    margin-left: 25%;
}
.AboutMe p {
    font-family: Camingo, sa;
    text-align: left;
    margin-top: -18% ;
    margin-left: 25%;
    font-size: 19px;s

}
.AboutMe img {
    margin-top: 1.5%;
    margin-left: 5%;
}
<!DOCTYPE html>
<html lang="nl">

<head>
	<meta charset="UTF-8">
	<title>Jack Dijkema</title>
	<link href="CSS/main.css" rel="stylesheet" />
	<link rel="stylesheet" href="CSS/header.css" />
	<link href='https://fonts.googleapis.com/css?family=Permanent+Marker:400' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="apple-touch-icon" sizes="180x180" href="/pics/apple-touch-icon.png">
	<link rel="icon" type="image/png" sizes="32x32" href="/pics/favicon-32x32.png">
	<link rel="icon" type="image/png" sizes="16x16" href="/pics/favicon-16x16.png">
	<link rel="manifest" href="/pics/site.webmanifest">
	<link rel="mask-icon" href="/pics/safari-pinned-tab.svg" color="#5bbad5">
	<link rel="shortcut icon" href="/pics/favicon.ico">
	<meta name="msapplication-TileColor" content="#da532c">
	<meta name="msapplication-config" content="/pics/browserconfig.xml">
	<meta name="theme-color" content="#ffffff">
</head>
<body>
	<div class="bg"></div>
<hr>
	<div class="AboutMe">
		<h1>ABOUT</h1>
   			<img src="https://jackdijkema.000webhostapp.com/pics/rsz_150982648_370567113534046_8331947271073836645_n%20(1).jpg" alt="Picture of Jack Dijkema About me section">
				<p>
				Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque sit amet hendrerit turpis.<br> Mauris commodo
				est ex, ac convallis tellus feugiat ac.<br>
				Praesent sit amet arcu quis elit pulvinar rhoncus.<br> Proin viverra lacinia ante, at interdum magna posuere eget.
				Cras rhoncus a neque ac scelerisque.<br> Pellentesque habitant morbi tristique senectus.
				</p>
			</div>
<div class="myProjects">
	<footer>
	Jack Dijkema Copyright 2019 - 
</footer>
</div>
<nav class="Hoofdnav">
		<ul>
			<li><a href="index.html">AboutMe</a></li><li><a href="index.html">Projects</a></li><li><a  rel="noopener" target="_blank" href="pdf/Jack%20Dijkema%20CV.pdf">CV</a></li>
		</ul>
</nav>
</body>
</html>

I also uploaded the whole website to:
https://jackdijkema.000webhostapp.com/

If u scale it to mobile device everything gets messed up.

最佳答案

我建议通读此 wiki on W3Schools.

基本上您需要做的是查看 CSS 中的媒体查询,因为它允许您在屏幕处于特定大小时设置不同的样式。

您还可以查看此 example of a responsive header.使用媒体查询可以在不使用 Bootstrap 或框架的情况下进行响应式设计。

关于html - 使我的网站能够扩展到移动设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55485343/

相关文章:

html - 输入字段按钮的动态工具提示的最佳方式

java - 修改之前设置的JEditorPane的CSS样式

javascript - HTML5 显示具有特定内容的 localStorage 元素

php - 如何让 PHPStorm 使用正确的 CSS 路径?

css - Span继承列表样式

angularjs - 查看端口根据用户选择调整大小

javascript - 我的 Joomla 网站堆在 Angular 落里

javascript - 外部 jQuery 文件似乎没有执行

css - 如何更改 wordpress 中只有一页的 css?

html - CSS 帮助 Wordpress