- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我的 flexbox 和文本有问题,它不像移动 View 中的导航栏那样跟随。我希望它用与菜单大小相同的文本填充屏幕。
问题:
我想看起来像我的 article-container
这样文本就可以填满整个移动屏幕。在桌面 View 中,它们是三个在一起,在移动 View 中,它们像汉堡包一样堆叠,类似于菜单上写着 Länk 1 2 3 4。
body {
margin: 0;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
width: 25%;
background-color: #EBEBEB;
position: fixed;
height: 100%;
overflow: auto;
}
li a {
display: block;
color: #000;
padding: 8px 16px;
text-decoration: none;
}
li a.active {
background-color: #F16529;
color: white;
}
li a:hover:not(.active) {
background-color: #555;
color: white;
}
.container {
margin-left: 25%;
padding: 1px 16px;
height: auto;
}
@media screen and (max-width: 480px) {
ul {
position: relative;
width: 100%;
}
.container {
margin: 0 auto;
padding: 1px 16px;
}
div.item {
width: initial;
max-width: 256px;
}
}
div.item {
vertical-align: top;
display: inline-block;
text-align: center;
max-width: 256px;
}
.blog {
max-width: 100%;
height: auto;
margin-left: auto;
margin-right: auto;
display: block;
}
.caption {
display: block;
}
img {
display: block;
}
img.wrap {
max-width: 70%;
margin: 30px 0px;
}
img.align-right {
float: right;
margin-left: 30px;
}
div.article-container {
padding: 5px;
}
.clearfix:after {
content: "";
display: table;
clear: both;
}
footer {
right: 0;
bottom: 0;
left: 0;
padding: 1rem;
background-color: #EBEBEB;
text-align: center;
}
@media(max-width:767px) {
img.align-right {
float: none;
margin: auto;
}
div.article-container {
padding: 5px;
text-align: center;
max-width: 256px;
}
}
.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>
<meta charset="utf-8">
<title>Inlämningsuppgift 6</title>
<meta content="width=device-width, initial-scale=1" name="viewport">
<link href="style.css" rel="stylesheet">
</head>
<body>
<!--nav bar-->
<nav>
<ul>
<li style="list-style: none"><br></li>
<li><img alt="htmll logo" src="https://www.w3.org/html/logo/downloads/HTML5_Logo_256.png"></li>
<li>
<h2>Menu</h2>
</li>
<li>
<a class="active" href="#lank">Länk 1</a>
</li>
<li>
<a href="#lank2">Länk 2</a>
</li>
<li>
<a href="#lank3">Länk 3</a>
</li>
<li>
<a href="#lank4">Länk 4</a>
</li>
</ul>
</nav><!--navbar end-->
<!--container for blog posts 3 images-->
</div>
<div class="container">
<h1>Innehåll</h1>
<div class="flex-grid-thirds">
<div class="col">
<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>
</div>
<div class="col">
<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>
</div>
<div class="col">
<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>
</div>
</div>
</div><!--end-->
<hr>
<!--container for article -->
<div class="container">
<div class="article-container clearfix">
<img alt="html logo" class="wrap align-right" 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>
<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>
</div>
</div><!--end-->
<footer class="container">
Skriven i HTML 5.
</footer>
</html>
最佳答案
您正在使用 .col
更新媒体查询中 .col
部分的宽度,但您使用 .flex-grid- 定义了初始宽度三分之二.col
。所以这只是你的媒体查询中的一个特殊性问题。在媒体查询选择器中使用 .flex-grid-thirds .col
。
body {
margin: 0;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
width: 25%;
background-color: #EBEBEB;
position: fixed;
height: 100%;
overflow: auto;
}
li a {
display: block;
color: #000;
padding: 8px 16px;
text-decoration: none;
}
li a.active {
background-color: #F16529;
color: white;
}
li a:hover:not(.active) {
background-color: #555;
color: white;
}
.container {
margin-left: 25%;
padding: 1px 16px;
height: auto;
}
@media screen and (max-width: 480px) {
ul {
position: relative;
width: 100%;
}
.container {
margin: 0 auto;
padding: 1px 16px;
}
div.item {
width: initial;
max-width: 256px;
}
}
div.item {
vertical-align: top;
display: inline-block;
text-align: center;
max-width: 256px;
}
.blog {
max-width: 100%;
height: auto;
margin-left: auto;
margin-right: auto;
display: block;
}
.caption {
display: block;
}
img {
display: block;
}
img.wrap {
max-width: 70%;
margin: 30px 0px;
}
img.align-right {
float: right;
margin-left: 30px;
}
div.article-container {
padding: 5px;
}
.clearfix:after {
content: "";
display: table;
clear: both;
}
footer {
right: 0;
bottom: 0;
left: 0;
padding: 1rem;
background-color: #EBEBEB;
text-align: center;
}
@media(max-width:767px) {
img.align-right {
float: none;
margin: auto;
}
div.article-container {
padding: 5px;
text-align: center;
max-width: 256px;
}
}
.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;
}
.flex-grid-thirds .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>
<meta charset="utf-8">
<title>Inlämningsuppgift 6</title>
<meta content="width=device-width, initial-scale=1" name="viewport">
<link href="style.css" rel="stylesheet">
</head>
<body>
<!--nav bar-->
<nav>
<ul>
<li style="list-style: none"><br></li>
<li><img alt="htmll logo" src="https://www.w3.org/html/logo/downloads/HTML5_Logo_256.png"></li>
<li>
<h2>Menu</h2>
</li>
<li>
<a class="active" href="#lank">Länk 1</a>
</li>
<li>
<a href="#lank2">Länk 2</a>
</li>
<li>
<a href="#lank3">Länk 3</a>
</li>
<li>
<a href="#lank4">Länk 4</a>
</li>
</ul>
</nav><!--navbar end-->
<!--container for blog posts 3 images-->
</div>
<div class="container">
<h1>Innehåll</h1>
<div class="flex-grid-thirds">
<div class="col">
<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>
</div>
<div class="col">
<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>
</div>
<div class="col">
<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>
</div>
</div>
</div><!--end-->
<hr>
<!--container for article -->
<div class="container">
<div class="article-container clearfix">
<img alt="html logo" class="wrap align-right" 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>
<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>
</div>
</div><!--end-->
<footer class="container">
Skriven i HTML 5.
</footer>
</html>
关于html - 段落的CSS flexbox问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44141998/
我面临着让一个相当复杂的网络应用程序在 HTML/CSS 中工作的问题。我发现 flexbox 有很多问题,这似乎可以解决我的问题。我试图了解我做错了什么或 flexbox 的限制是什么。我只在 Ch
尝试扩展 FlexBox 容器内输入的宽度。我希望它与父容器具有相同的宽度。这是我的 view.xml:
尝试扩展 FlexBox 容器内输入的宽度。我希望它与父容器具有相同的宽度。这是我的 view.xml:
我有两个 flexbox,它们在高度变化时收缩,嵌套内容重叠。 如何防止这种情况? 最佳答案 just add flex-shrink:0 to your element and the flexbo
我对 FlexBoxes 有疑问 - 我想要 我想将页面的一个部分分成两部分(相同高度),例如每个 100 像素 这些部分之一(第 2 个)我想分成三个小部分(等高)100/3 = 33px 下面的代
我的内容布局由三个部分组成:页眉、内容和页脚。对于小型设备,我想保留此顺序,在桌面设备上,我想将页眉和页脚移至侧边栏。 使用 float 实现:http://codepen.io/anon/pen/j
我正在尝试实现以下布局: +---------+---------------------+ |legend | | +---------+
我在尝试使用 Flexbox 进行某些标记时遇到问题。我制作了这个代码笔来演示我的问题:http://codepen.io/anon/pen/QjbzJY?editors=110 我希望左侧的图像(.
我正在尝试获得一个看起来有点像这样的用户界面: 在图片中,假装带有“New York...”的顶部栏和“Book it”按钮是固定的,并且它们之间的内容是可滚动的。 到目前为止,我的 HTML 是这样
我尝试调整一些动态内容,使其适合要打印的标签。 标签有一行 (.symbolContainer),可以包含 0 个或多个图像。目标是在 .text 框的内容需要更多空间时缩小 .symbolConta
我是 Stack Overflow 的新手,我遇到了 flexbox 的问题。 我想使用 和 与 display: flex;其中 main 的每一行都有 2 列 height: 100%浏览器和页脚
我想创建一个带有部分的水平 slider 。 Section 1 Card 1 ... Section 2 Card 1 ... ...
在给定的代码中,我需要识别第一行的最后一个元素和最后一行的第一个元素。只是为了让它从各个 Angular 落变圆。我怎样才能做到这一点?我需要在这里提到的是,根据屏幕尺寸,列号以及第一行的最后一个元素
我花了一整天的时间来完成这项工作。虽然我可以使用一个 flex 盒,但当一个 flex 盒要包含另一个 flex 盒时就会变得很麻烦。 我试着按照这个问题的提示去做: Flexbox inside a
在我的测试中(以及我的其他 SO 问题的回答),当 flexbox 占用页面的整个宽度或具有固定宽度的父元素时,它可以很好地处理溢出文本。但是,如果具有动态宽度的 flexbox 在另一个动态宽度 f
我正在尝试让一个 flexbox 在 flexbox 内部工作。当第一个(包装)flexbox 工作时,里面的那个什么都不做。无论如何让这个工作? 我想要做的是有效地拥有两个粘性页脚,并且两者的高度都
我正在尝试使用 flexboxes 并想组合一个列和行容器。我的问题是: 为什么放置在列中的行元素没有跨越 flex 容器的整个宽度? 此处显示示例代码:js-fiddle HTML: /* CSS:
目标 我正在使用 SASS 开发一个基于 flexbox + calc() 的 grid system with gutters。 您可以像这样通过混合定义网格: .box { @inc
在IE11下运行时,下面的例子会在itemwrapper的底部添加空格元素。在开发控制台中检查时,此空间不归因于边距、填充或边框。测量子元素的高度似乎是一个问题,因为如果给它们一个固定的高度,那么空间
我的目标是在 Angular 5 项目中使用 ag-grid,并让网格占据 Flexbox 布局中的所有可用垂直空间。当网格包含在具有定义的像素高度的 div 中时,或者当 div 具有百分比高度但不
我是一名优秀的程序员,十分优秀!