gpt4 book ai didi

html - 响应式网站有问题

转载 作者:太空宇宙 更新时间:2023-11-04 12:35:36 25 4
gpt4 key购买 nike

我在使用手机、平板电脑和台式机/笔记本电脑时遇到检测问题?我想知道我做错了什么。我提供了代码,它并不完整,但我不明白为什么当我将屏幕从移动设备调整为台式机/笔记本电脑显示器时,一切都不合适。我想知道当我返回桌面 View 时如何重置?调整我在网站上显示的图像的大小也有问题。我想根据设备的大小相应地调整大小。我有一个 Logo 图像和一个横幅图像,在这两个图像之上是导航栏,由于导航栏位于灰色背景之上,我在调整大小和使其透明方面也遇到了问题。我怎样才能让它在横幅和标志上透明。我感谢迄今为止获得的所有帮助。我有很大的进步。谢谢你们!

这是html代码:

    <nav>
<ul>
<li><a class="selected" href="index.html">Home</a></li>
<li><a href="chat.html">Get Help</a></li>
<li><a href="http://community.yesican.org">Community</a></li>
<li><a href="resources.html">Resources</a></li>
<li><a href="about.html">About YIC</a></li>
<li><a href="supportyic.html">Get Involved</a></li>
</ul>
</nav>
</header>


<img id="banner" src="img/banner.jpg"/>
<!--The main content of the website will go inside of the #wrapper id. It is divided into two sections: #primary & #secondary.-->
<div id="wrapper">
<!-- Two sections have been created for desktop view to have two columns. Mobile website will just be stacked-->
<div id="content">
<section id="primary"><!--Left column content goes here-->
<h2>Who We Are</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean in elementum velit, venenatis rhoncus lacus. Ut consequat luctus enim, in auctor libero posuere ut. Curabitur vitae aliquet nisi. Etiam condimentum tincidunt venenatis. Fusce vel congue purus. Pellentesque ut eleifend ex. Nunc purus neque, aliquam vitae aliquam quis, accumsan id lacus. Nunc ac scelerisque magna. Etiam purus lorem, rutrum et ornare a, tincidunt non ipsum. Nullam blandit dui venenatis, malesuada felis a, porttitor purus.</p>
<p><a href="#">This is how a link looks.</a></p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean in elementum velit, venenatis rhoncus lacus. Ut consequat luctus enim, in auctor libero posuere ut. Curabitur vitae aliquet nisi. Etiam condimentum tincidunt venenatis. Fusce vel congue purus. Pellentesque ut eleifend ex. Nunc purus neque, aliquam vitae aliquam quis, accumsan id lacus. Nunc ac scelerisque magna. Etiam purus lorem, rutrum et ornare a, tincidunt non ipsum. Nullam blandit dui venenatis, malesuada felis a, porttitor purus.</p>
</section>

<section id="secondary"><!--Right column content goes here-->
<h2>Memorial</h2>
<img src="img/memorial_list.jpg"/>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean in elementum velit, venenatis rhoncus lacus. Ut consequat luctus enim, in auctor libero posuere ut.</p>
</section>
</div>
</div>

<!--Footer still needs to be completed-->
<footer>
<div id="footer-right">
<ul><h3>ABOUT</h3>
<li><a href="">Contact Us</a></li>
<li><a href="">FAQ's</a></li>
<li><a href="">Site Map</a></li>
</ul>
<ul><h3>SUPPORT OUR CAUSE</h3>
<li><a href="">Donate</a></li>
<li><a href="">Volunteer</a></li>
<li><a href="">Fundraising Events</a></li>
</ul>
<ul><h3>FOLLOW US</h3>
<li>
<a href="#Facebook handle here"><img src="img/facebook-icon.png" alt="Facebook Logo" class="social-icon"></a>
<a href="#Instagram handle here"><img src="img/instagram-icon.png" alt="Instagram Logo" class="social-icon"></a>
<a href="#Twitter handle here"><img src="img/twitter-icon.png" alt="Twitter Logo" class="social-icon"/></a>
<a href="#Pinterest handle here"><img src="img/pinterest-icon.png" alt="Pinterest Logo" class="social-icon"/></a>
</li>
</ul>
</div>
<div id="footer-left">
<p id="footer-slogan">BREAK THE <strong>SILENCE</strong> <br>AND <strong>CYCLE</strong> OF ABUSE</p>
<p id="copyright">Copyright&copy; 2014 International Child Advocacy Network</p>
</div>
</footer>

这是responisve.css代码:

  /*This is the placeholder for responsive CSS that we will implement for mobile design*/

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

#content{
text-align:center;
}
#body{
float left; font-family:Fabrica
}
#nav{
text align:center; font-size:.9em;
}
}

/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
/* Styles */
@font-face {
font-family: 'Fabrica';
font-style: normal;
font-weight: 100;
src: local('Fabrica'), local('Fabrica'), url(path/Fabrica.otf) format('otf');
}

}

/* Smartphones (portrait) ----------- */
@media only screen
and (max-width : 320px) {
/* Styles */
@font-face {
font-family: 'Fabrica';
font-style: normal;
font-weight: 100;
src: local('Fabrica'), local('Fabrica'), url(path/Fabrica.otf) format('otf');
}

}

/* 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 */
}
/*************************************
TWO COLUMN LAYOUT

Will target anything larger than average smartphone.
This is helpful for normal sized tablets, very large smartphones, and very small desktop windows.
***************************************/

#primary {
width: 50%;
float: left;
padding:10px;
}
#secondary {
width: 40%;
float: right;
padding:10px;
}

最佳答案

试试这个:

#primary, #secondary {
dialay:inline-block;
width:45%;
padding:.5%;
margin:.5%;
}

相同的样式适用于两个 div。无需 float 。然后你应该把它们放在一起:

<dig align=center><div id="primary"><div id="secondary"></div>

而且它们应该不错。

关于html - 响应式网站有问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27302841/

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