Zacznę na nowo żeby było łatwiej zrozumieć. Chcę aby na strona book na urządzeniu mobilnym ( telefonie ) wczytywała się do najniżej zdeklarowanej wartości, czyli
/* ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲ 720PX ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲ */
@media screen and (max-width: 720px) {
#container {
width: 100%;
}
link do pliku css tutaj oraz cały kod css:
/* _________ B O O K _________ */
body {
margin: 0 !important;
background-color:#222;
font-size:20px;
font-weight: bold;
color: #fff;
letter-spacing: 1px;
text-shadow: 1px 1px #000, 2px 2px #000;
transition: all .3s ease-in-out;
}
body a {
color: #ccc;
text-decoration: none;
transition: all .3s ease-in-out;
}
body div {
transition: all .3s ease-in-out;
}
img {
transition: all .3s ease-in-out;
}
#container {
display: flex;
flex-wrap: wrap;
justify-content: center;
margin-left: auto;
margin-right: auto;
min-width: 720px;
max-width: 1250px;
padding: 30px 0px 140px 0px;
}
.logo {
display: flex;
align-items: center;
justify-content: space-around;
width: 95%;
height: 60px;
min-width: 720px;
margin-bottom: 30px;
background-image:radial-gradient(ellipse at bottom, #e59400 5%, transparent 100%);
box-shadow:0 0px 20px 0px #e59400 inset;
border-radius: 15px;
}
.logo div {
display: flex;
align-items: center;
justify-content: center;
height: 60px;
}
.logotitle {
min-width: 380px;
}
.logotitle div {
border-radius: 15px;
box-shadow:0 10px 20px 0px #000;
}
.logotitle div:hover {
border-radius: 15px;
box-shadow:0 0px 30px 10px #e59400;
}
.logoimg {
min-width:85px;
background: url("../image/book.png") no-repeat center;
background-size:50px 50px;
}
.logotitle a {
font-size: 25px;
padding: 15px 15px 15px 20px;
letter-spacing: 5px;
background-image:radial-gradient(ellipse at bottom, #e59400 10%, #111 130%);
border: 3px solid #ccc;
box-shadow:0 0px 10px 0px #e59400 inset;
text-shadow: 1px 1px #000, 2px 2px #000, 3px 3px #000, 4px 4px #000;
border-radius: 15px;
}
.logotitle a:hover {
color: #fff;
font-size: 28px;
border: 4px solid #eee;
background-image:radial-gradient(ellipse at bottom, #e59400 10%, #222 130%);
box-shadow:0 0px 20px 0px #e59400 inset;
}
.logohome {
min-width:85px;
}
.logohome img {
width: 60px;
border: 2px solid #ccc;
border-radius: 15px;
}
.logohome img:hover {
width: 65px;
border: 3px solid #eee;
-webkit-filter: brightness(120%);
filter: brightness(120%);
}
/* â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛ BOOK BOX â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛ */
.bookbox {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
width: 90%;
max-width: 1000px;
margin-bottom: 30px;
border: 5px solid #ce8500;
background-color: #e59400;
box-shadow:0 10px 20px 0px #000;
border-radius: 10px;
}
.bookbox:hover {
border: 5px solid #a06700;
background-color: #ce8500;
box-shadow:0 0px 20px 0px #a06700;
}
.booktitle {
display: flex;
align-items: center;
justify-content: center;
text-align: center;
width: 100%;
padding: 10px;
color: #fff;
font-size: 28px;
letter-spacing: 3px;
margin-left: 3px;
text-shadow: 1px 1px #000, 2px 2px #000, 3px 3px #000, 4px 4px #000, 5px 5px #000;
}
.aboutbox {
width: 100%;
margin: 0px 10px 10px 10px;
padding:20px;
text-indent: 30px;
border-radius: 10px;
background-color: #222;
box-shadow:0 0px 100px 0px #000 inset;
color:fff;
}
.aboutbox img {
float: left;
max-width: 250px;
max-height: 250px;
border: 3px solid #ccc;
margin-right: 20px;
}
.aboutbox p {
text-indent: 30px;
margin: 10px 0px 0px 0px;
}
.aboutbox span {
font-size: 14px;
}
#bgimage {
height: 0;
width: 0;
}
/* â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛ 720PX â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛ */
@media screen and (max-width: 720px) {
#container {
width: 100%;
}
}
/* â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛ 720PX END â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛ */
#topbox {
display: none;
}
/* â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛ 1150PX â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛ */
@media screen and (min-width: 1150px) {
/* â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛ TOP â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛ */
#topbox {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
padding: 5px 0px 5px 0px;
}
#fb {
display: flex;
align-items: center;
justify-content: flex-start;
width: 50%;
height: 40px;
margin-left: 50px;
}
#top {
display: flex;
align-items: center;
justify-content: flex-end;
width: 50%;
height: 40px;
margin-right: 50px;
}
#top div {
display: flex;
align-items: center;
justify-content: center;
width: 13%;
height: 100%;
}
#onlinebox {
background-color:#333;
box-shadow:0 5px 30px 0px #000 inset;
border-radius:10px;
font-size: 35px;
background: url("../image/listeners.png") no-repeat center;
background-size: 35px 35px;
transition: all .3s ease-in-out;
}
#onlinebox:hover {
color: #fff;
font-size: 40px;
background: url("../image/listeners.png") no-repeat center;
background-size: 40px 40px;
}
#bgimage {
height: auto;
width: 100%;
position: fixed;
z-index: -100;
left: 0px;
min-height: 938px;
min-width: 1250px;
}
#container {
padding: 0px 0px 70px 0px;
}
.logohome {
width:100px;
}
.logohome img {
width: 70px;
border: 2px solid #ccc;
border-radius: 15px;
}
.logohome img:hover {
width: 75px;
border: 3px solid #eee;
-webkit-filter: brightness(120%);
filter: brightness(120%);
}
}
/* â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛ 1150PX END â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛ */
/* â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛ 900PX â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛ */
@media screen and (min-width: 900px) {
.aboutbox {
color: #ccc;
box-shadow:0 0px 50px 0px #000 inset;
}
.bookbox:hover .aboutbox {
color: #fff;
}
.bookbox:hover .aboutbox {
box-shadow:0 0px 100px 0px #000 inset;
}
}
/* â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛ 900PX END â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛â˛ */
Oczywiście w pliku css mam również inne wartości jak np.
@media screen and (min-width: 1150px) {
gdyż chcę aby strona dostosowywała się również do okna(iframe) na stronie głównej tzn index
Dodając do kodu html tą wartość:
<meta name="viewport" content="width=device-width, initial-scale=1">
spowodowało, że na telefonie strona wczytuje się do najniższej zdeklarowanej wartości, czyli 720px .
Jednak okno o wartości 720px po załadowaniu jest przybliżone za każdym razem o ok. 50% do lewego górnego rogu, a nie wyświetlone w pełnej swojej okazałości. Nie wiem czemu ma miejsce taka sytuacja.
Na stronie phone posiadam ten sam kod html, lecz css bez użytego @media screen, i strona wczytuje się w pełnej swojej okazałości czyli 400px . Na telefonie kiedy z menu wybieram Contact, wczytuje się div który rozciąga swoją szerokością domyślną wartość 400px w ten sposób że strona wygląda dziwnie. Identyczna sytuacja ma się z Song History (ikona zegara).