javascript - display flex 和 width 100% 的元素导致元素水平移动
问题描述
我试图了解主要原因是什么以及如何在这里解决我的问题。我有一个固定宽度的元素和 2 个 100% 的子元素。在最里面的元素显示下设置为flex
. 然后我可以水平移动元素。无论如何,我可以通过修改类来解决这个问题,section
并且panel
?我想在面板下保持 5px 的边距显示或不显示滚动条
codepen.io
.section{
overflow-x: auto;
overflow-y: scroll;
width : 100%;
border: 2px solid blue;
}
.panel{
width: 100%;
margin: 5px;
display:flex;
}
.App {
width: 570px;
padding: 5px;
border: 2px solid red;
}
<body>
<div class='App'>
<div class='section'>
<div class='panel'>
<span> label </span>
<input />
<span> label </span>
<input />
<span> label </span>
<input />
<span> label </span>
<input />
<p>real-world studies published Wednesday confirm that the immune protection offered by two doses of Pfizer's Covid-19 vaccine drops off after two months or so, although protection against severe disease, hospitalization and death remains strong. The studies,
from Israel and from Qatar and published in the New England Journal of Medicine, support arguments that even fully vaccinated people need to maintain precautions against infection. One study from Israel covered 4,800 health care workers and
showed antibody levels wane rapidly after two doses of vaccine 'especially among men, among persons 65 years of age or older, and among persons with immunosuppression.' Vaccines may have prevented a quarter-million Covid-19 cases and 39,000
deaths among seniors Vaccines may have prevented a quarter-million Covid-19 cases and 39,000 deaths among seniors 'We conducted this prospective longitudinal cohort study involving health care workers at Sheba Medical Center, a large tertiary
medical center in Israel,' Sheba's Dr. Gili Regev-Yochay and colleagues wrote. The researchers noted that levels of so-called neutralizing antibodies -- the immune system's first line of defense against infection -- correlate with protection
against infection, but for this study they studied only antibody levels.
</p>
<p>real-world studies published Wednesday confirm that the immune protection offered by two doses of Pfizer's Covid-19 vaccine drops off after two months or so, although protection against severe disease, hospitalization and death remains strong. The studies,
from Israel and from Qatar and published in the New England Journal of Medicine, support arguments that even fully vaccinated people need to maintain precautions against infection. One study from Israel covered 4,800 health care workers and
showed antibody levels wane rapidly after two doses of vaccine 'especially among men, among persons 65 years of age or older, and among persons with immunosuppression.' Vaccines may have prevented a quarter-million Covid-19 cases and 39,000
deaths among seniors Vaccines may have prevented a quarter-million Covid-19 cases and 39,000 deaths among seniors 'We conducted this prospective longitudinal cohort study involving health care workers at Sheba Medical Center, a large tertiary
medical center in Israel,' Sheba's Dr. Gili Regev-Yochay and colleagues wrote. The researchers noted that levels of so-called neutralizing antibodies -- the immune system's first line of defense against infection -- correlate with protection
against infection, but for this study they studied only antibody levels.
</p>
<p>real-world studies published Wednesday confirm that the immune protection offered by two doses of Pfizer's Covid-19 vaccine drops off after two months or so, although protection against severe disease, hospitalization and death remains strong. The studies,
from Israel and from Qatar and published in the New England Journal of Medicine, support arguments that even fully vaccinated people need to maintain precautions against infection. One study from Israel covered 4,800 health care workers and
showed antibody levels wane rapidly after two doses of vaccine 'especially among men, among persons 65 years of age or older, and among persons with immunosuppression.' Vaccines may have prevented a quarter-million Covid-19 cases and 39,000
deaths among seniors Vaccines may have prevented a quarter-million Covid-19 cases and 39,000 deaths among seniors 'We conducted this prospective longitudinal cohort study involving health care workers at Sheba Medical Center, a large tertiary
medical center in Israel,' Sheba's Dr. Gili Regev-Yochay and colleagues wrote. The researchers noted that levels of so-called neutralizing antibodies -- the immune system's first line of defense against infection -- correlate with protection
against infection, but for this study they studied only antibody levels.
</p>
<p>
real-world studies published Wednesday confirm that the immune protection offered by two doses of Pfizer's Covid-19 vaccine drops off after two months or so, although protection against severe disease, hospitalization and death remains strong. The studies,
from Israel and from Qatar and published in the New England Journal of Medicine, support arguments that even fully vaccinated people need to maintain precautions against infection. One study from Israel covered 4,800 health care workers and
showed antibody levels wane rapidly after two doses of vaccine 'especially among men, among persons 65 years of age or older, and among persons with immunosuppression.' Vaccines may have prevented a quarter-million Covid-19 cases and 39,000
deaths among seniors Vaccines may have prevented a quarter-million Covid-19 cases and 39,000 deaths among seniors 'We conducted this prospective longitudinal cohort study involving health care workers at Sheba Medical Center, a large tertiary
medical center in Israel,' Sheba's Dr. Gili Regev-Yochay and colleagues wrote. The researchers noted that levels of so-called neutralizing antibodies -- the immune system's first line of defense against infection -- correlate with protection
against infection, but for this study they studied only antibody levels.
</p>
<p>
real-world studies published Wednesday confirm that the immune protection offered by two doses of Pfizer's Covid-19 vaccine drops off after two months or so, although protection against severe disease, hospitalization and death remains strong. The studies,
from Israel and from Qatar and published in the New England Journal of Medicine, support arguments that even fully vaccinated people need to maintain precautions against infection. One study from Israel covered 4,800 health care workers and
showed antibody levels wane rapidly after two doses of vaccine 'especially among men, among persons 65 years of age or older, and among persons with immunosuppression.' Vaccines may have prevented a quarter-million Covid-19 cases and 39,000
deaths among seniors Vaccines may have prevented a quarter-million Covid-19 cases and 39,000 deaths among seniors 'We conducted this prospective longitudinal cohort study involving health care workers at Sheba Medical Center, a large tertiary
medical center in Israel,' Sheba's Dr. Gili Regev-Yochay and colleagues wrote. The researchers noted that levels of so-called neutralizing antibodies -- the immune system's first line of defense against infection -- correlate with protection
against infection, but for this study they studied only antibody levels.
</p>
</div>
</div>
</div>
</body>
解决方案
我现在不是你想要的,但我可能会帮助你。使用 css "grid" 来处理你的问题。
.section{
overflow-x: auto;
overflow-y: scroll;
width : 100%;
border: 2px solid blue;
}
.panel{
width: 100%;
margin: 5px;
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
grid-gap: 5px;
}
.App {
width: 570px;
padding: 5px;
border: 2px solid red;
}
<body>
<div class='App'>
<div class='section'>
<div class='panel'>
<div>
<span> label </span>
<input />
</div>
<div>
<span> label </span>
<input />
</div>
<div>
<span> label </span>
<input />
</div>
<div>
<span> label </span>
<input />
</div>
<div>
<span> label </span>
<input />
</div>
</div/>
<div class="panel">
<p>real-world studies published Wednesday confirm that the immune protection offered by two doses of Pfizer's Covid-19 vaccine drops off after two months or so, although protection against severe disease, hospitalization and death remains strong. The studies,
from Israel and from Qatar and published in the New England Journal of Medicine, support arguments that even fully vaccinated people need to maintain precautions against infection. One study from Israel covered 4,800 health care workers and
showed antibody levels wane rapidly after two doses of vaccine 'especially among men, among persons 65 years of age or older, and among persons with immunosuppression.' Vaccines may have prevented a quarter-million Covid-19 cases and 39,000
deaths among seniors Vaccines may have prevented a quarter-million Covid-19 cases and 39,000 deaths among seniors 'We conducted this prospective longitudinal cohort study involving health care workers at Sheba Medical Center, a large tertiary
medical center in Israel,' Sheba's Dr. Gili Regev-Yochay and colleagues wrote. The researchers noted that levels of so-called neutralizing antibodies -- the immune system's first line of defense against infection -- correlate with protection
against infection, but for this study they studied only antibody levels.
</p>
<p>real-world studies published Wednesday confirm that the immune protection offered by two doses of Pfizer's Covid-19 vaccine drops off after two months or so, although protection against severe disease, hospitalization and death remains strong. The studies,
from Israel and from Qatar and published in the New England Journal of Medicine, support arguments that even fully vaccinated people need to maintain precautions against infection. One study from Israel covered 4,800 health care workers and
showed antibody levels wane rapidly after two doses of vaccine 'especially among men, among persons 65 years of age or older, and among persons with immunosuppression.' Vaccines may have prevented a quarter-million Covid-19 cases and 39,000
deaths among seniors Vaccines may have prevented a quarter-million Covid-19 cases and 39,000 deaths among seniors 'We conducted this prospective longitudinal cohort study involving health care workers at Sheba Medical Center, a large tertiary
medical center in Israel,' Sheba's Dr. Gili Regev-Yochay and colleagues wrote. The researchers noted that levels of so-called neutralizing antibodies -- the immune system's first line of defense against infection -- correlate with protection
against infection, but for this study they studied only antibody levels.
</p>
<p>real-world studies published Wednesday confirm that the immune protection offered by two doses of Pfizer's Covid-19 vaccine drops off after two months or so, although protection against severe disease, hospitalization and death remains strong. The studies,
from Israel and from Qatar and published in the New England Journal of Medicine, support arguments that even fully vaccinated people need to maintain precautions against infection. One study from Israel covered 4,800 health care workers and
showed antibody levels wane rapidly after two doses of vaccine 'especially among men, among persons 65 years of age or older, and among persons with immunosuppression.' Vaccines may have prevented a quarter-million Covid-19 cases and 39,000
deaths among seniors Vaccines may have prevented a quarter-million Covid-19 cases and 39,000 deaths among seniors 'We conducted this prospective longitudinal cohort study involving health care workers at Sheba Medical Center, a large tertiary
medical center in Israel,' Sheba's Dr. Gili Regev-Yochay and colleagues wrote. The researchers noted that levels of so-called neutralizing antibodies -- the immune system's first line of defense against infection -- correlate with protection
against infection, but for this study they studied only antibody levels.
</p>
<p>
real-world studies published Wednesday confirm that the immune protection offered by two doses of Pfizer's Covid-19 vaccine drops off after two months or so, although protection against severe disease, hospitalization and death remains strong. The studies,
from Israel and from Qatar and published in the New England Journal of Medicine, support arguments that even fully vaccinated people need to maintain precautions against infection. One study from Israel covered 4,800 health care workers and
showed antibody levels wane rapidly after two doses of vaccine 'especially among men, among persons 65 years of age or older, and among persons with immunosuppression.' Vaccines may have prevented a quarter-million Covid-19 cases and 39,000
deaths among seniors Vaccines may have prevented a quarter-million Covid-19 cases and 39,000 deaths among seniors 'We conducted this prospective longitudinal cohort study involving health care workers at Sheba Medical Center, a large tertiary
medical center in Israel,' Sheba's Dr. Gili Regev-Yochay and colleagues wrote. The researchers noted that levels of so-called neutralizing antibodies -- the immune system's first line of defense against infection -- correlate with protection
against infection, but for this study they studied only antibody levels.
</p>
<p>
real-world studies published Wednesday confirm that the immune protection offered by two doses of Pfizer's Covid-19 vaccine drops off after two months or so, although protection against severe disease, hospitalization and death remains strong. The studies,
from Israel and from Qatar and published in the New England Journal of Medicine, support arguments that even fully vaccinated people need to maintain precautions against infection. One study from Israel covered 4,800 health care workers and
showed antibody levels wane rapidly after two doses of vaccine 'especially among men, among persons 65 years of age or older, and among persons with immunosuppression.' Vaccines may have prevented a quarter-million Covid-19 cases and 39,000
deaths among seniors Vaccines may have prevented a quarter-million Covid-19 cases and 39,000 deaths among seniors 'We conducted this prospective longitudinal cohort study involving health care workers at Sheba Medical Center, a large tertiary
medical center in Israel,' Sheba's Dr. Gili Regev-Yochay and colleagues wrote. The researchers noted that levels of so-called neutralizing antibodies -- the immune system's first line of defense against infection -- correlate with protection
against infection, but for this study they studied only antibody levels.
</p>
</div>
</div>
</div>
</body>
推荐阅读
- html - 如何删除 MDBootstrap 类默认选择颜色
- android - 在具有 Mediatek MT6735P 芯片组和 Cortex-A53 CPU 的 64 位 armv8 设备上崩溃
- php - 如何获取嵌套在其他模型后面的存储数据
- reactjs - 子组件在 ReactJS 中使用父母的 Prop
- java - 使用 Amazon AWS SQS 实施 JMS onMessage() 可以降低成本吗?
- javascript - 如何在 javascript 中使用 aynsc/await 从异步操作返回对象
- python - 如何浏览图像并在 Python 中显示?
- ffmpeg - ffmpeg 字幕对齐和位置
- java - 使用字段表示对象集合时如何使用过滤表达式创建规范?
- python - 如何根据通过 android MIC 记录的心音计算每分钟的心跳次数?