没有媒体查询的响应式CSS内容

时间:2016-01-08 20:36:35

标签: css iphone mobile responsive-design viewport

好的,所以我正在处理我的website,我试图让它响应,但没有在CSS中使用任何框架或@media查询。我在CSS的宽度,高度和字体上使用了相对长度,如%,vw和vh。当我上传website时,我觉得这个工作正常。当我重新调整浏览器窗口的大小时,它会起作用(减去填充和边距问题)。我认为我的想法一直有效,直到我在iphone 6s和平板电脑上检查我的网站。 iPhone和平板电脑在纵向时看起来不错,但在风景中它真的很糟糕!我想要的想法是,所有内容都要调整大小/缩小,并保持在身体周围的黄色边框内。我可以在不使用媒体查询的情况下这样做吗?如何使用视口正确缩小我的内容?

HTML& CSS



html{
	overflow: hidden;
    overflow-x: hidden;
    overflow-y: hidden;
}

body {
  height: 100vh;
  width: auto;
  margin: 0;
  padding: 0;
  position: relative;
  text-align: center;
  font-family: 'PT Sans', sans-serif;
  color: #ffff00; 
}

body::before {
  content: '';
  position: absolute;
  top: 30px;
  left: 30px;
  right: 30px;
  bottom: 30px;
  border: 3px solid yellow;
}

p a {
	color: #ffff00;
	letter-spacing: 5px;
}


video{
	position: fixed;
	transform: translate(-50%, -50%);
	top: 50%;
	left: 50%;
	min-width: 100%;
	min-height: 100%;
	width: auto;
	height: auto;
	z-index: -1;
}

.screen {
	position: fixed;
	right: 0;
	bottom: 0;
	min-width: 100%;
	min-height: 100%;
	width: auto;
	height: auto;
	background: grey;
	opacity: 0.4;

}

.container{
	display: block;
	text-align: center;
	padding-top: 50px;
	margin: 0px auto; 
	min-width: 60%;

}

.menu{
	height: 50%;
	width:50%;
	left: 50%;
	top: 50%;
	display: inline-block;
	text-align: center;
}

.logo{
	display: inline-block;
	max-height: 25vh; 
	max-width:  25vw;
	text-align: center;
	padding-top: 40px;
	padding-bottom: 40px;
}

.logo h1{
	font-size: 3vw;
	letter-spacing: 4px;
}

.nav-menu{
	margin: 20px auto;
	font-size: 2vw;
	display: inline-block;
	padding: 13px 2px 1px 2px;
	border: 3px solid #ffff00;
	line-height: 0px;
}

<!doctype html>
  <html lang="en">
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <!-- SEO META -->
  <meta name="keywords" content="HTML, Meta Tags, Metadata" />
  <meta name="description" content="WEBSITE">
  <meta name="author" content="SitePoint">
    <title>| Louis Lombardi |</title>

    <!-- Custom CSS -->
    <link href="css/styles.css" rel="stylesheet">
    <link href='https://fonts.googleapis.com/css?family=PT+Sans:400,700' rel='stylesheet' type='text/css'>
  <!--[if lt IE 9]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->
</head>
<body>
              <!-- video -->
               <video id='video' preload>   
                  <source  src="vid/vt1.mp4" type="video/mp4" > 
                    <p>Your browser does not support HTML5 video.</p> 
               </video> 
<!-- MENU SECTION --> 
      <div class="container">
        <div class="menu col-12">
            <div class="logo"> <img src="img/louis-media-logo.png" class="img-responsive" alt="media and design logo"> <h1>MEDIA</h1> </div>
            <div class="clear-fix"></div>
             <div class="nav-menu"> <p> <a href="#">ABOUT</a> </p> </div>
              <div class="clear-fix"></div>
                <div class="nav-menu"> <p> <a href="#">PORJECTS</a> </p> </div>
                  <div class="clear-fix"></div>
                   <div class="nav-menu"> <p> <a href="#">CONTACT</a> </p> </div>
        </div> 
    </div> <!-- Container --> 

</body>
</html>
&#13;
&#13;
&#13;

0 个答案:

没有答案