18910140161

html-我的网站的主要内容在移动时溢出得太靠右-堆栈溢出

顺晟科技

2022-10-19 14:12:26

114

我创建了一个带有专栏的被动网站,但出于某种原因,专栏在移动屏幕上的位置太远了,超出了页眉和页脚的结尾。我做了媒体查询,以使站点的两列相互反应(堆叠在一起),不知道为什么当屏幕较小时,它们会像这样伸展。谁能修复我的代码,使容器不会溢出?非常感谢!


顺晟科技:

你的标签已经很长了,你必须在这里休息。它将断开所有长的非空格字符串

/* Add a background color with some padding to the body */

body {
  background: #383f51;
  font-family: Geneva, sans-serif;
}

/* Header and Blog Title */

header {
  background: #91c7b1;
  margin-top: 15px;
  padding: 5px;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  text-align: center;
}

header h1 {
  font-size: 42px;
  font-family: "Electrolize", sans-serif;
}

header p {
  font-style: italic;
  font-size: 24px;
}

/* navbar/*
/* top navigation bar style */
nav {
  background-color: #000;
  overflow: hidden;
  display: block;
  height: auto;
  width: auto;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
}

/* navigation bar links */

nav a {
  float: left;
  color: white;
  text-align: center;
  font-size: 20px;
  padding: 10px;
  margin-left: 5px;
  text-decoration: underline;
  font-family: "Electrolize", sans-serif;
}
/* Create two unequal columns that floats next to each other */
/* Left column */
.rightcolumn {
  flex: 1;
}

.leftcolumn {
  flex: 5;
}

/* Responsive layout - when the screen is less than 800px wide, make the two columns stack on top of each other instead of next to each other */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

main > .row {
  display: flex;
}

@media screen and (max-width: 800px) {
  main > .row {
    flex-direction: column;
  }
}

/* images (work in progress at the moment) */
/* images and videos (work in progress at the moment) */
.iframe-container {
  position: relative;
  width: 100%;
  padding-bottom: 60.25%;
}
.iframe-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 20px;
}
/* Post layout for articles and additional areas */
.post {
  display: block;
  background-color: white;
  padding: 20px;
  margin-top: 10px;
  border-style: solid;
  border-color: #91c7b1;
  border-radius: 25px;
}
article h2,
article h2 a,
.post h2 {
  font-size: 24px;
  text-decoration: none;
  color: #533a71;
}
article h4 {
  padding-top: 15px;
}
article h5 {
  font-size: 16px;
}
.post p {
  line-height: 1.5em;
  font-size: 16px;
}

/* Footer */

.footer {
  color: black;
  margin-top: 10px;
  left: 0;
  bottom: 0;
  width: 100%;
  background-color: #91c7b1;
  text-align: center;
  font-size: 18px;
  border-radius: 25px;
}

当单词溢出其容器时,可以使用以上CSS属性断开该单词。

  • TAG:
相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航