使我的网站可扩展到移动设备

时间:2019-04-03 00:30:21

标签: html css

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

我认为在移动设备上以彼此下面的块预览它吗?我该怎么做,因为我的文字会与我的图像混合,并且导航栏链接会变得混乱并相互滑动?

当屏幕变小时,我用响应式导航栏阅读了一些内容,将其变成了汉堡菜单。

视口设置为: <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.

1 个答案:

答案 0 :(得分:0)

我建议您通读此wiki on W3Schools.

基本上,您需要做的是调查CSS中的媒体查询,因为这样一来,您就可以为屏幕处于特定尺寸时设置不同的样式。

您还可以签出此example of a responsive header.响应式设计,而无需使用Bootstrap,也可以使用媒体查询来构建框架。