0
觸發移動媒體查詢時遇到響應問題。 畫布剛剛消失。HTML5響應畫布大小調整
問題:
調整到移動設備時,水彩畫布剛剛消失。
其中一個解決方案:
硬編碼的div <canvas id="main" width="1024" height="640"></canvas>
JSBIN: http://jsbin.com/poposopahi/edit?html,css,output
@charset "utf-8";
/* Global Styles */
body {
\t margin-left: auto;
\t margin-right: auto;
\t width: 92%;
\t max-width: 960px;
\t padding-left: 2.275%;
\t padding-right: 2.275%;
}
/* Header */
header {
\t text-align: center;
\t display: block;
}
header .profileLogo .logoPlaceholder {
\t background-color: white;
\t color:black;
\t width: 300px;
\t text-align: center;
}
header .logoPlaceholder span {
\t width: 180px;
\t height: 22px;
\t font-family: 'Montserrat', sans-serif;
\t color: black;
\t font-size: 30px;
\t font-weight: 700;
\t line-height: 53px;
}
header .logoPlaceholder2 span {
\t width: 180px;
\t height: 22px;
\t font-family: 'Montserrat', sans-serif;
\t color: black;
\t font-size: 30px;
\t font-weight: 700;
\t line-height: 53px;
}
header .profilePhoto {
\t background-color: rgba(237,237,237,1.00);
\t width: 259px;
\t border-radius: 50%;
\t height: 259px;
\t clear: both;
}
header .profileHeader h1 {
\t font-family: 'Montserrat', sans-serif;
\t color: rgba(146,146,146,1.00);
\t font-size: 30px;
\t font-weight: 700;
\t line-height: 24px;
}
header .profileHeader h3 {
\t font-family: sans-serif;
\t color: rgba(146,146,146,1.00);
\t font-size: 16px;
\t font-weight: 700;
\t line-height: 24px;
}
hr {
\t background-color: rgba(208,207,207,1.00);
\t height: 1px;
}
header .profileHeader p {
\t font-family: sans-serif;
\t color: rgba(146,146,146,1.00);
\t font-size: 14px;
\t font-weight: 400;
\t line-height: 1.8;
\t overflow-y: auto;
}
header .socialNetworkNavBar {
\t text-align: center;
\t display: block;
\t margin-top: 60px;
\t clear: both;
}
header .socialNetworkNavBar .socialNetworkNav {
\t border-radius: 50%;
\t cursor: pointer;
}
header .socialNetworkNavBar .socialNetworkNav img:hover {
\t opacity: 0.5;
}
/* Media query for Mobile devices*/
@media only screen and (min-width : 285px) and (max-width : 480px) {
/* Header */
header {
\t width: 100%;
\t float: none;
}
.wrapper {
display: inline-block;
width: 50%;
height: 50%;
} \t
header .profileLogo .logoPlaceholder {
\t display: inline-block;
\t text-align: left;
}
header .profilePhoto {
\t display: inline-block;
}
header .profileHeader {
\t text-align: center;
\t margin-top: 10%;
}
header .profileHeader p {
\t text-align: justify;
}
header .socialNetworkNavBar {
\t text-align: center;
\t display: block;
\t margin-top: 60px;
\t clear: both;
\t margin-bottom: 15%;
}
header .socialNetworkNavBar .socialNetworkNav {
\t width: 60px;
\t height: 60px;
\t display: inline-block;
\t margin-right: 23px;
}
}
/* Media Query for Tablets */
@media only screen and (min-width : 481px) and (max-width : 1024px) {
/* Header */
header {
\t width: 100%;
\t float: none;
}
header .profileLogo .logoPlaceholder {
\t display: inline-block;
\t font-family: 'Montserrat', sans-serif;
}
header .profilePhoto {
\t float: left;
\t clear: both;
\t margin-right: 3%;
\t margin-top: 5%;
}
header .profileHeader {
\t text-align: left;
\t margin-top: 7%;
}
header .socialNetworkNavBar .socialNetworkNav {
\t width: 74px;
\t height: 74px;
\t display: inline-block;
\t margin-right: 23px;
}
}
/* Desktops and laptops */
@media only screen and (min-width:1025px) {
/* Header */
header .profileLogo .logoPlaceholder {
\t float: left;
\t margin-bottom: 50px;
}
header .profilePhoto {
\t float: left;
\t clear: both;
\t margin-right: 3%;
}
header .profileHeader {
\t text-align: left;
\t padding-top: 10%;
}
header .socialNetworkNavBar .socialNetworkNav {
\t width: 74px;
\t height: 74px;
\t display: inline-block;
\t margin-right: 23px;
}
\t
.wrapper {
display: table;
padding: 0;
width: 100%;
height: 100%;
}
.container {
display: table-cell;
vertical-align: middle;
}
.canvas-container {
position: relative;
max-width: 1024px;
min-width: 120px;
margin: 0 auto;
}
#main {
width: auto;
background-color: aqua;
} \t
\t
\t
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>About Page template By Adobe Dreamweaver CC</title>
<link href="AboutPageAssets/styles/aboutPageStyle.css" rel="stylesheet" type="text/css">
<!--The following script tag downloads a font from the Adobe Edge Web Fonts server for use within the web page. We recommend that you do not modify it.-->
<script>var __adobewebfontsappname__="dreamweaver"</script><script src="http://use.edgefonts.net/montserrat:n4:default;source-sans-pro:n2:default.js" type="text/javascript"></script>
<script>
</script>
</head>
<body>
<!-- Header content -->
<header>
<div class="profileLogo">
<!-- Profile logo. Add a img tag in place of <span>. -->
<p class="logoPlaceholder"><!-- <img src="logoImage.png" alt="sample logo"> --><span>Name :</span></p>
<p class="logoPlaceholder"><!-- <img src="logoImage.png" alt="sample logo"> --><span>Attempts :</span></p>
<p class="logoPlaceholder"><!-- <img src="logoImage.png" alt="sample logo"> --><span>Score :</span></p>
</div>
<section>
<div class="wrapper">
<div class="container">
<div class="canvas-container">
<canvas id="main" width="1024" height="640"></canvas>
</div>
</div>
</div>
</section>
<!-- Links to Social network accounts -->
<aside class="socialNetworkNavBar">
<div class="socialNetworkNav">
<!-- Add a Anchor tag with nested img tag here -->
<img src="AboutPageAssets/images/social.png" alt="sample"> </div>
<div class="socialNetworkNav">
<!-- Add a Anchor tag with nested img tag here -->
<img src="AboutPageAssets/images/social.png" alt="sample"> </div>
<div class="socialNetworkNav">
<!-- Add a Anchor tag with nested img tag here -->
<img src="AboutPageAssets/images/social.png" alt="sample"> </div>
</aside>
</header>
<!-- content -->
</body>
</html>
感謝您指出我的誤差小,我忘記了支架已被關閉。 – FreedomPride