gpt4 book ai didi

html - CSS - 网站在 iPad 上拖出屏幕

转载 作者:行者123 更新时间:2023-11-28 11:18:24 27 4
gpt4 key购买 nike

我的网站本质上是一个全屏网站,占用了所有可用空间来显示网站。因此,页面内容必须自动调整以适应其显示的屏幕尺寸。

对于某些元素,我使用了float,这样段落就可以并排显示,因此我不得不float页脚,这样如果内容区域的高度增加,页脚将向下移动以适应正文需要占用的额外空间。

如果没有 float,页脚将不会向下移动,如果屏幕较窄,主要内容会溢出到它上面。

因此,在 iPad 上,主要内容区域和页脚会拖到屏幕的一侧。我知道这是 float 的问题,因为 header 没有这样做;只有内容区域和页脚。

我想解决这个问题,但不知道该怎么做。

网址是http://neerajmorar.co.uk

它在 PC、Linux 上完美运行,我假设是 Mac,因为它在 Safari 上运行良好,但在 iPad 上运行不佳。

索引页的HTML代码:

<!DOCTYPE html>

<html lang="en">

<head>
<title>Neeraj Morar | Home</title>
<meta charset="UTF-8">
<meta name="description" content="This is the personal website of Neeraj Morar.">
<meta name="keywords" content="Neeraj, Morar, neerajmorar, neerajmorar.co.uk, personal, website, portfolio, home, computing, information, systems, university, of, west, london, sql, server, web, design">
<meta name="google-site-verification" content="k3NDZl5POUlqaDoEEOTdrX50XrOcQ9nmQr9IFJK1NlU" />
<meta name="msvalidate.01" content="6F4E786D9BE746A1AC789E62D2C0F961" />
<link type="text/css" rel="stylesheet" href="StyleSheet1.css">
<link type="text/css" rel="stylesheet" href="mobile.css" media="only screen and (max-device-width: 480px)">
<script type="text/javascript" src="jquery-2.0.3.min.js"></script>
<script>(function (a, b) { if (/android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) window.location = b })(navigator.userAgent || navigator.vendor || window.opera, 'http://m.neerajmorar.co.uk');</script>
<script type="text/javascript">
$(document).ready(function () {
$(".content").css("display", "none");
$(".content").fadeIn(5000);
if ($(".header a").click(function (event) {
event.preventDefault();
linkLocation = this.href;
$(".content").fadeOut(1000, redirectPage);
}));
else if ($(".transition").click(function (event) {
event.preventDefault();
linkLocation = this.href;
$(".content").fadeOut(1000, redirectPage);
}));

function redirectPage() {
window.location = linkLocation;
}
});
</script>
</head>

<body>
<div class="header">
<ul class="index">
<li><a href="index.html">NeerajMorar.co.uk</a></li>
</ul>
<ul class="nav">
<li class="links"><a href="index.html">Home</a></li>
<li class="links"><a href="aboutme.html">About Me</a></li>
<li class="links"><a href="computingskills.html">Computing Skills</a></li>
<li class="links"><a href="webdesign.html">Web Design</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
<div class="box">
<div class="content">
<div class="hello">
<h2>Hello, I'm Neeraj</h2>
<p>Business Systems Apprentice at Stanmore College, Student at University of West London, and TIME's Person of the Year 2006. (No, seriously, it's true!)</p>
</div>
<div class="taken">
<h2>I have a very particular set of skills...</h2>
<p>Oh, boy, do I! Pianist at heart (or a pedantic Organist, depending on how you look at it), a Black Belt in Tae Kwon Do, and a true nerd - not a skill, but I thought it would be nice to throw it in there!</p>
</div>
<div class="site">
<h2>This site?</h2>
<p>This website has been designed to give you an overview of who I am and what I do; it's a chance for you to be seduced by me! Please feel free to look around, and don't hesitate to <a href="contact.html" class="transition">contact me</a>.</p>
</div>
</div>
</div>
<div class="footer">
<div class="info">
<a href="http://www.w3.org/html/logo/">
<img src="http://www.w3.org/html/logo/badge/html5-badge-h-css3.png" width="133" height="64" alt="HTML5 Powered with CSS3 / Styling" title="HTML5 Powered with CSS3 / Styling">
</a>
<small>&#169; Copyright 2013 by Neeraj Morar. All Rights Reserved.</small>
</div>
</div>

</body>

</html>

CSS 代码:

@font-face
{
font-family: "Skolar OT";
src: url("fonts/SKOLAR-REGULAR-PVT.OTF");
}

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

body
{
font-family: "Skolar OT", Calibri, Arial, sans-serif;
margin-top: -18px;
margin-left: auto;
margin-right: auto;
text-align: justify;
font-size: larger;
background-color: #e6e6e6;
}

.header
{
height: 224px;
background-color: #ab0000;
box-shadow: 0px 4px 5px #696969;
}

.index
{
display: block;
position: relative;
top: 44%;
width: 505px;
margin-left: auto;
margin-right: auto;
}

.index li
{
display: inline;
font-size: 300%;
}

.nav
{
position: relative;
top: -83px;
margin-left: auto;
margin-right: auto;
width: 670px;
background-color: #780000;
padding: 10px;
border-radius: 0px 0px 3px 3px;
}

.nav li
{
display: inline;
font-size: x-large;
padding-left: 10px;
}

.links
{
border-style: none solid none none;
border-width: 2px;
padding-right: 10px;
}

.header a
{
color: #fff;
transition: 0.7s;
}

.header a:hover
{
color: #d2d2d2;
}

.box
{
margin-top: 10px;
min-height: 560px;
border-style: none;
margin-left: auto;
margin-right: auto;
background-color: #e6e6e6;
padding: 25px;
}

.content
{
max-width: 1500px;
margin-top: 50px;
margin-left: auto;
margin-right: auto;
margin-bottom: 50px;
}

.footer
{
float: left;
width: 97.45%;
background-color: #780000;
height: 83px;
padding: 25px;
}

.footer small
{
position: relative;
display: block;
top: 10px;
color: #e6e6e6;
}

.hello
{
max-width: 600px;
margin-left: auto;
margin-right: auto;
}

.taken
{
max-width: 600px;
margin-top: 50px;
margin-left: auto;
margin-right: auto;
}

.site
{
max-width: 600px;
margin-top: 50px;
margin-right: auto;
margin-left: auto;
}

.about
{
width: 47.5%;
float: left;
margin-right: 5%;
}

.job
{
width: 47.5%;
float: left;
}

.ambition
{
width: 47.5%;
float: left;
margin-right: 5%;
}

.other
{
width: 47.5%;
float: left;
}

.compute
{
max-width: 600px;
font-size: larger;
margin-left: auto;
margin-right: auto;
}

.web
{
width: 40%;
float: left;
margin-left: 8%;
margin-right: 5%;
}

.software
{
width: 40%;
float: left;
}

.web2
{
max-width: 700px;
font-size: x-large;
margin-left: auto;
margin-right: auto;
}

.contact
{
margin-left: 22%;
margin-right: 22%;
}

#smooth
{
width: 100%;
float: left;
}

a
{
text-decoration: none;
color: black;
}

fieldset
{
border-style: none;
border-color: black;
border-width: 1px;
}

textarea
{
font-family: Arial, sans-serif;
background-color: #fff;
background-color: rgba(203, 203, 203, 0.5);
border-color: black;
border-width: 1px;
}

input[type="text"]
{
font-family: Arial, sans-serif;
background-color: #fff;
background-color: rgba(203, 203, 203, 0.5);
border-color: black;
border-width: 1px;
}

input[type="email"]
{
font-family: Arial, sans-serif;
background-color: #fff;
background-color: rgba(203, 203, 203, 0.5);
border-color: black;
border-width: 1px;
}

li a.transition
{
font-weight: bold;
transition: 0.5s;
}

li a.transition:hover
{
opacity: 0.5;
}

li a.transition:active
{
color: #000;
}

.content p a.transition
{
font-weight: bold;
transition: 0.5s;
}

.content p a.transition:hover
{
opacity: 0.5;
}

.content p a.transition:active
{
opacity: 0.5;
}

.a1
{
font-weight: bold;
transition: 0.5s;
}

.a1:hover
{
opacity: 0.5;
}

#a1
{
font-weight: bold;
transition: 0.5s;
}

#a1:hover
{
opacity: 0.5;
}

您可以从那里查看我网站的源代码和样式表...

最佳答案

尝试在页脚前使用 clear:both 并在您的内容区域中使用 overflow:hidden。这样你就可以摆脱 float 。

关于html - CSS - 网站在 iPad 上拖出屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21650541/

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