我的柔性箱有問題,文字不符合移動視圖中的導航欄。我希望它用與菜單大小相同的文本填充屏幕。CSS柔性箱問題
問題:
我想看起來像我article-container
使文本在整個手機屏幕填寫。在桌面視圖,他們三個在一起,並在移動視圖,它們堆疊像類似菜單漢堡包在那裏說LANK 1 2 3 4
body {
\t margin: 0;
}
ul {
\t list-style-type: none;
\t margin: 0;
\t padding: 0;
\t width: 25%;
\t background-color: #EBEBEB;
\t position: fixed;
\t height: 100%;
\t overflow: auto;
}
li a {
\t display: block;
\t color: #000;
\t padding: 8px 16px;
\t text-decoration: none;
}
li a.active {
\t background-color: #F16529;
\t color: white;
}
li a:hover:not(.active) {
\t background-color: #555;
\t color: white;
}
.container {
\t margin-left: 25%;
\t padding: 1px 16px;
\t height: auto;
}
@media screen and (max-width: 480px) {
\t ul {
\t \t position: relative;
\t \t width: 100%;
\t }
\t .container {
\t \t margin: 0 auto;
\t \t padding: 1px 16px;
\t }
\t div.item {
\t \t width: initial;
\t \t max-width: 256px;
\t }
}
div.item {
\t vertical-align: top;
\t display: inline-block;
\t text-align: center;
\t max-width: 256px;
}
.blog {
\t max-width: 100%;
\t height: auto;
\t margin-left: auto;
\t margin-right: auto;
\t display: block;
}
.caption {
\t display: block;
}
img {
\t display: block;
}
img.wrap {
\t max-width: 70%;
\t margin: 30px 0px;
}
img.align-right {
\t float: right;
\t margin-left: 30px;
}
div.article-container {
\t padding: 5px;
}
.clearfix:after {
\t content: "";
\t display: table;
\t clear: both;
}
footer {
\t right: 0;
\t bottom: 0;
\t left: 0;
\t padding: 1rem;
\t background-color: #EBEBEB;
\t text-align: center;
}
@media(max-width:767px) {
\t img.align-right {
\t \t float: none;
\t \t margin: auto;
\t }
\t div.article-container {
\t \t padding: 5px;
\t \t text-align: center;
\t \t max-width: 256px;
\t }
}
.flex-grid {
display: flex;
}
.flex-grid .col {
flex: 1;
}
.flex-grid-thirds {
display: flex;
justify-content: space-between;
}
.flex-grid-thirds .col {
width: 32%;
}
@media (max-width: 400px) {
.flex-grid,
.flex-grid-thirds {
display: block;
.col {
width: 100%;
margin: 0 0 10px 0;
}
}
}
* {
box-sizing: border-box;
}
body {
padding: 20px;
}
.flex-grid {
margin: 0 0 20px 0;
}
<!DOCTYPE html>
<html>
<head>
\t <meta charset="utf-8">
\t <title>Inlämningsuppgift 6</title>
\t <meta content="width=device-width, initial-scale=1" name="viewport">
\t <link href="style.css" rel="stylesheet">
</head>
<body>
\t <!--nav bar-->
\t <nav>
\t \t <ul>
\t \t \t <li style="list-style: none"><br></li>
\t \t \t <li><img alt="htmll logo" src="https://www.w3.org/html/logo/downloads/HTML5_Logo_256.png"></li>
\t \t \t <li>
\t \t \t \t <h2>Menu</h2>
\t \t \t </li>
\t \t \t <li>
\t \t \t \t <a class="active" href="#lank">Länk 1</a>
\t \t \t </li>
\t \t \t <li>
\t \t \t \t <a href="#lank2">Länk 2</a>
\t \t \t </li>
\t \t \t <li>
\t \t \t \t <a href="#lank3">Länk 3</a>
\t \t \t </li>
\t \t \t <li>
\t \t \t \t <a href="#lank4">Länk 4</a>
\t \t \t </li>
\t \t </ul>
\t </nav><!--navbar end-->
\t <!--container for blog posts 3 images-->
\t </div>
\t <div class="container">
\t \t <h1>Innehåll</h1>
\t \t <div class="flex-grid-thirds">
\t \t \t <div class="col">
\t \t \t \t \t \t \t <img alt="htmll logo" class="blog" src="https://www.w3.org/html/logo/downloads/HTML5_Logo_256.png" alligment >
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
\t \t \t </div>
\t \t \t <div class="col">
\t \t \t \t \t \t \t <img alt="htmll logo" class="blog" src="https://www.w3.org/html/logo/downloads/HTML5_Logo_256.png">
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
\t \t \t </div>
\t \t \t <div class="col">
\t \t \t \t \t \t \t <img alt="htmll logo" class="blog" src="https://www.w3.org/html/logo/downloads/HTML5_Logo_256.png">
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
\t \t \t </div>
\t \t </div>
\t </div><!--end-->
\t <hr>
\t <!--container for article -->
\t <div class="container">
\t \t <div class="article-container clearfix">
\t \t \t <img alt="html logo" class="wrap align-right" src="https://www.w3.org/html/logo/downloads/HTML5_Logo_256.png">
\t \t \t <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
\t \t \t <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
\t \t </div>
\t </div><!--end-->
\t <footer class="container">
\t \t Skriven i HTML 5.
\t </footer>
</html>