gpt4 book ai didi

html - 当我最小化或更改窗口时,我的网站尺寸出现问题

转载 作者:行者123 更新时间:2023-11-28 05:38:11 26 4
gpt4 key购买 nike

所以我一直在一个网站上工作:vivascoaching.com,当窗口最大化时它看起来很好,但是当我最小化它或开始改变窗口时,一切都乱七八糟。即使窗口已更改,我如何将所有内容都保留在边距中?这是我的索引页面的 HTML 和整个网站的 CSS。

我的代码:

html{
height:100%;
width:100%
}

header{
margin-left: 20px;
margin-bottom:5px;
}

body{
background-color: #00B8E5;
font-family: "Comic Sans MS", sans-serif;
}

h1,h2,h3{
color: #112C84;
}

a:link {
color: #112C84;
text-decoration: none;
font-size: 120%;
}


object {
border-style: solid;
}



/*-------NAV STYLING------------*/

#mainlinks li{
float:left;
margin-left:150px;
}

#secondarylinks li{
margin-bottom:20px;
margin-top:40px;
padding-right:5px;
}

#secondarylinks ul{
padding-left:20px;
}




/*---------- COLUMN STYLING ----------*/

.left_column{
float:left;
width:8%;
margin-left:5px;
}


.middle_column{
float:left;
background-color:white;
text-align:center;
width:70%;
margin:2px;
padding:10px;
border-style: solid;
}


.right_column{
float:left;
text-align:center;
width:10%;
margin:5px;
}
<!DOCTYPE HTML>
<html>
<head>
<title>Vivas Coaching-Main</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../style/main.css">
<link rel="stylesheet" href="../style/normalize.css">

</head>


<body>
<header>
<img src="Images/logo.png" alt="logo" width="465px" height="135px" align="middle">
</header>

<div class="left_column">
<nav id="secondarylinks">
<ul>
<li><a href="register.html" title="Register">Register</a></li>
<li><a href="dates.html" title="Dates">Dates</a></li>
<li><a href="pricing.html" title="Pricing">Pricing</a></li>
<li><a href="forms.html" title="Forms">Forms</a></li>
</ul>
</nav>
</div>

<div class="middle_column">
<nav id="mainlinks">
<ul>
<li><a href="index.html" title="Main">Main</a></li>
<li><a href="classes.html" title="Classes">Classes</a></li>
<li><a href="teambuilding.html" title="Team Building">Team Building</a></li>
</ul>
</nav>

<img src="Images/SAT summer flyer.jpg" alt="SAT summer flyer" width="800px" height="800px">
<footer>
<p>&copy;VivasCoaching 2016</p>
</footer>
</div>

<div class="right_column">
<h2>Contact Us</h2>
<p>(646)316-8481/<br>(403)718-0159</p>
<p>Please fill out the information below and we will get back to you as soon as possible!<p>

<form method="post" action="callback.php">
<label for="firstname">First Name: </label>
<input type="text" name="firstname"/>

<label for="lastname">Last Name: </label>
<input type="text" name="lastname"/>

<label for="email">Email: <span class="required"></label>
<input type="text" name="email"/>

<label>*What is 2+2? (Anti-spam)</label>
<input name="human" placeholder="Type Here">

<label for="message"> Message: <span class="required"></label>

<textarea id="message" name="message" cols="25" rows="10" placeholder="Type your message here!"></textarea>
<input type="submit" id="submit"/>
</form>
</div>

</body>
</html>

最佳答案

修复你的 html 错误将所有这些媒体查询代码添加到你的 css 表的底部

/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}

/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
/* Styles */
}

/* Smartphones (portrait) ----------- */
@media only screen
and (max-width : 320px) {
/* Styles */
}

/* iPads (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
/* Styles */
}

/* iPads (landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
/* Styles */
}

/* iPads (portrait) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
/* Styles */
}

/* Desktops and laptops ----------- */
@media only screen
and (min-width : 1224px) {
/* Styles */
}

/* Large screens ----------- */
@media only screen
and (min-width : 1824px) {
/* Styles */
}

/* iPhone 4 ----------- */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}
/* iPhone 6 landscape */
@media only screen and (min-device-width: 375px)
and (max-device-width: 667px)
and (orientation: landscape)
and (-webkit-min-device-pixel-ratio: 2)
{ }

/* iPhone 6 portrait */
@media only screen
and (min-device-width: 375px)
and (max-device-width: 667px)
and (orientation: portrait)
and (-webkit-min-device-pixel-ratio: 2)
{ }

/* iPhone 6 Plus landscape */
@media only screen
and (min-device-width: 414px)
and (max-device-width: 736px)
and (orientation: landscape)
and (-webkit-min-device-pixel-ratio: 3)
{ }

/* iPhone 6 Plus portrait */
@media only screen
and (min-device-width: 414px)
and (max-device-width: 736px)
and (orientation: portrait)
and (-webkit-min-device-pixel-ratio: 3)
{ }

/* iPhone 6 and 6 Plus */
@media only screen
and (max-device-width: 640px),
only screen and (max-device-width: 667px),
only screen and (max-width: 480px)
{ }

/* Apple Watch */
@media
(max-device-width: 42mm)
and (min-device-width: 38mm)
{ }

关于html - 当我最小化或更改窗口时,我的网站尺寸出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38064850/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com