Hy! Ich möchte meine HTML- und CSS-Seite Größe ändern, wenn der Benutzer die Größe von Browser-Fenster ändert, und ich möchte die Seite an verschiedene Auflösungen anpassen. Ich habe hier auf dieser Seite einige Antworten versucht, aber sie funktionieren nicht für mich. ich versuchte auch Medien zu verwenden abfragtAnpassung der HTML-Seite
Hier finden Sie die CSS und die html
* {
\t margin: 0;
\t padding: 0;
}
body{
\t font-family: 'Francois One', Arial, Helvetica, sans-serif;
\t color: white;
\t text-align:center;
\t background:black;
\t
}
.corpo{
\t margin-top: 5px;
\t margin-left: 400px;
\t margin-right: 250px;
\t float:middle;
\t
}
header{
\t margin: 40px 0;
}
.menu li{
\t display: block;
\t float: left;
\t width: 125px;
\t height: 50px;
\t line-height: 50px;
\t text-align: center;
\t color: #2C3E50;
\t border-right: 1px solid #2C3E50;
\t background: -webkit-linear-gradient(top, #FFFF00 50%, #FFFF00 51%, #f6f6f6 100%);
\t background: -moz-linear-gradient(top, #FFFF00 50%, #FFFF00 51%, #f6f6f6 100%);
\t background: -o-linear-gradient(top, #FFFF00 50%, #FFFF00 51%, #f6f6f6 100%);
\t background: -ms-linear-gradient(top, #FFFF00 50%, #FFFF00 51%, #f6f6f6 100%);
\t border-color:black;
\t opacity:1;
\t position:relative;
}
.menu li:hover{
\t cursor: pointer;
\t background: -webkit-radial-gradient(center, ellipse cover, #ffffff 0%, #e5e5e5 100%);
\t background: -moz-radial-gradient(center, ellipse cover, #ffffff 0%, #e5e5e5 100%);
\t background: -o-radial-gradient(center, ellipse cover, #ffffff 0%, #e5e5e5 100%);
\t background: -ms-radial-gradient(center, ellipse cover, #ffffff 0%, #e5e5e5 100%);
\t color: slateGrey;
\t border-color:black;
\t position:relative;
}
.primo{
\t border-top-left-radius: 10px;
\t border-bottom-left-radius: 10px;
}
.ultimo{
\t border-top-right-radius: 10px;
\t border-bottom-right-radius: 10px;
}
.sub-menu{
\t visibility: hidden;
}
.menu li:hover .sub-menu{
\t visibility: visible;
}
.sub-menu li{
\t border-top: 1px dotted #2C3E50;
}
.sub-menu li:hover{
\t width: 145px;
\t background: -webkit-radial-gradient(center, ellipse cover, #f7fbfc 10%, #add9e4 100%);
\t background: -moz-radial-gradient(center, ellipse cover, #f7fbfc 10%, #add9e4 100%);
\t background: -o-radial-gradient(center, ellipse cover, #f7fbfc 10%, #add9e4 100%);
\t background: -ms-radial-gradient(center, ellipse cover, #f7fbfc 10%, #add9e4 100%);
\t transition: all 0.1s ease 0s;
\t -webkit-transition: all 0.1s ease 0s;
\t -moz-transition: all 0.1s ease 0s;
\t -o-transition: all 0.1s ease 0s;
\t -ms-transition: all 0.1s ease 0s;
}
.ultimo-sub{
\t border-bottom-left-radius: 10px;
\t border-bottom-right-radius: 10px;
}
.menu li a:link{
color:black;
text-decoration:none;
}
.menu li a:hover{
color:black;
text-decoration:none;
}
.menu li a:active{
color:black;
text-decoration:none;
}
.menu li a:visited{
color:black;
text-decoration:none;
}
p{
\t color: #FFFF00;
\t margin: 0px 380px 0px 400px;
\t font-size:150%;
\t text-shadow: 2px 0 0 #000, 0 -1px 0 #000, 0 2px 0 #000, -1px 0 0 #000; //text-shadow: 2px 0 0 #000, 0 -1px 0 #000, 0 2px 0 #000, -1px 0 0 #000;
\t
}
.Paragrafo{
\t text-shadow:1px 0 0 #000, 0 -1px 0 #000, 0 1px 0 #000, -1px 0 0 #000;
\t size:25px;
}
.Paragrafo a:link{
color:yellow;
}
.Paragrafo a:hover{
color:yellow;
}
.Paragrafo a:active{
color:yellow;
}
.Paragrafo a:visited{
color:yellow;
}
h1{
\t color:blue;
\t
}
span{
\t color: #FFFF00;
\t margin: 0px 380px 0px 400px;
\t font-size:150%;
\t text-shadow: 2px 0 0 #000, 0 -1px 0 #000, 0 2px 0 #000, -1px 0 0 #000; //text-shadow: 2px 0 0 #000, 0 -1px 0 #000, 0 2px 0 #000, -1px 0 0 #000;
\t
}
.video{
\t position: 404 532;
}
<!doctype html>
<html>
\t <head>
\t \t <meta charset="UTF-8">
\t \t <title>Menù a tendina in HTML e CSS</title>
\t \t <link rel="stylesheet" type="text/css" href="new 1(!).css">
\t \t <style> h1 {color:yellow;
\t \t float:center;
\t \t } </style> \t \t
\t </head> \t \t \t
\t <body>
\t
\t \t
\t \t <header>
\t \t \t \t <h1>La Grande Guerra</h1>
\t \t </header>
\t \t <div class="corpo">
\t \t \t <ul class="menu">
\t \t \t \t <li class="primo"><a href="SitoHome2(!).html">Home</a></li>
\t \t \t \t <li><a href="1914.html">1914</a>
\t \t \t \t </li>
\t \t \t \t <li><a href="1915.html">1915</a>
\t \t \t \t \t <ul class="sub-menu">
\t \t \t \t \t \t <li><a href="1915-1.html">Da 01 a 04</a></li>
\t \t \t \t \t \t <li><a href="1915-2.html">Da 05 a 08</a></li>
\t \t \t \t \t \t <li class="ultimo-sub"><a href="1915-3.html">Da 09 a 12</a></li>
\t \t \t \t \t </ul>
\t \t \t \t </li>
\t \t \t \t <li><a href="1916.html">1916</a>
\t \t \t \t \t <ul class="sub-menu">
\t \t \t \t \t \t <li><a href="1916-1.html">Da 01 a 04</a></li>
\t \t \t \t \t \t <li><a href="1916-2.html">Da 05 a 08</a></li>
\t \t \t \t \t \t <li class="ultimo-sub"><a href="1916-3.html">Da 09 a 12</a></li>
\t \t \t \t \t </ul>
\t \t \t \t </li>
\t \t \t \t <li><a href="1917.html">1917</a>
\t \t \t \t \t <ul class="sub-menu">
\t \t \t \t \t \t <li><a href="1917-1.html">Da 01 a 04</a></li>
\t \t \t \t \t \t <li><a href="1917-2.html">Da 05 a 08</a></li>
\t \t \t \t \t \t <li class="ultimo-sub"><a href="1917-3.html">Da 09 a 12</a></li>
\t \t \t \t \t </ul>
\t \t \t </li>
\t \t \t \t <li><a href="1918.html">1918</a>
\t \t \t \t \t <ul class="sub-menu">
\t \t \t \t \t \t <li class="ultimo-sub"><a href="1918-1.html">Eventi</a></li>
\t \t \t \t </ul>
\t \t \t \t </li>
\t \t \t \t <li><a href="#">Armistizio</a>
\t \t \t \t \t <ul class="sub-menu">
\t \t \t \t \t \t <li class="ultimo-sub"><a href="#">Conseguenze</a></li>
\t \t \t \t </ul>
\t \t \t \t </li>
\t \t \t \t <li><a href="Galleria.html">Galleria</a>
\t \t \t \t \t <ul class="sub-menu">
\t \t \t \t </ul>
\t \t \t \t </li>
\t \t \t \t <li class="ultimo"><a href="Fonti.html">Fonti</A></li>
\t \t \t \t
\t \t \t </ul>
\t \t </div> <BR> <br> <br> <br> <br> <br> <br>
\t \t <div class=Paragrafi>
\t \t <p>
\t \t
TEXT
\t \t <object class=video width="420" height="315"data="https://www.youtube.com/embed/6FgaL0xIazk?list=PLB2vhKMBjSxOb_127vxjaRRC7yu2TJlJX"
\t \t float=left align=right>
</object>
\t \t </p>
\t \t <p align=left>
TEXT
\t \t </p>
\t \t
\t \t
</body>
</html>
Sie können versuchen, einige fertige CSS-Frameworks wie Bootstrap für effiziente responsive Webdesign verwenden –
Hy Jones, können Sie mir ein Beispiel schreiben? –