html - 无法将我的福利等级移到右边

标签 html css

我尝试注释掉除 perks 类之外的所有 css,但我仍然无法通过更改边距使其向右移动。

我对 CSS 比较陌生,所以我可能犯了一个明显的错误,但我花了几个小时尝试调试,因为它不是我其余 css 的边距,也不是我的任何其他类干扰津贴。

Fiddle

body {
  background: url("costume.jpg");
  background-size: cover;
  margin: 0;
  color: white;
  font-family: athelas;
}
.intro {
  margin: 0, 0, 20px, 0;
  width: 50%;
  margin-left: auto;
  margin-right: auto;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 10px;
  border-radius: 25px;
  position: absolute;
  left: 25%
}
ul {
  text-align: left;
  padding: 10px;
  background: rgba(0, 0, 0, 0.5);
  font-size: 20px;
}
li {
  display: inline;
  padding: 0px 15px 0px 0px;
}
h1 {
  font-size: 50px;
  color: rgba(255, 255, 255, .5);
  text-align: center;
}
p {
  font-size: 20px;
  color: rgba(255, 255, 255, .5);
  text-align: center;
}
form {
  right: 251px;
}
input {
  padding: 8px;
  right: 25px;
}
input[type="text"] {
  border: none;
  margin-left: 20px;
}
input[type="password"] {
  margin: 15px 0px 0px 20px;
  border: none;
}
button {
  width: 120px;
  padding: 16px;
  background-color: rgba(133, 68, 176, 0.75);
  font-family: athelas;
  font-size: 16px;
  right: 25px;
  margin-top: 20px;
  margin-left: 80%;
  margin-bottom: 7px;
}
.friends {
  background: url(jessa.jpg);
  background-size: cover;
  margin: 30% 0 0 43%;
  height: 200px;
  width: 200px;
  position: relative;
  display: inline-block;
  overflow: hidden;
}
.hahaid {
  opacity: 0;
  font-size: 63px;
  color: white;
  line-height: 28px;
}
.hahaid:hover {
  text-align: center;
  font-size: 20px;
  padding: 70px 50px 73px 50px;
  position: relative;
  margin: 0 auto;
  background: rgba(0, 0, 0, .7);
  opacity: 1;
}
.perks {
  background: url(roadtrip.jpg);
  width: 400px;
  height: 200px;
  position: relative;
  margin-right: 30%;
  display: inline-block;
  vertical-align: text-bottom;
  margin: 0 auto;
}
<!DOCTYPE html>

<body>
  <ul>
    <li>Home</li>
    <li>Profile</li>
    <li>Chat</li>
    <li>Login</li>
    <li>Sign up</li>
  </ul>

  <div class="intro">
    <h1>What are you waiting for?</h1>
    <p>You can use this messaging client to send actual messages to other humans!</p>
    <p>This is legit guys, I swear.</p>
    <form action="profile_form.asp">
      <input type="text" name="username" placeholder="Username">
      <br>
      <input type="password" name="password" placeholder="Password">
      <br>
      <button type="submit" value="Login" style="border:none;">Submit</button>
    </form>

  </div>
  <div class="friends">
    <p class="hahaid">Chat with friends.</p>
  </div>
  <div class="perks">
    <p class="coolbeans">Connect with family.</p>
  </div>

</body>

</html>

最佳答案

我以此为中心:

.perks {
    background: url(roadtrip.jpg); 
    background-size: cover;
    margin: 1% 10% 10% 12%;
    display: inline-block;
    overflow: hidden;
    width: 400px;
    height: 200px;
    position: relative;
    vertical-align: text-bottom;
}

不完全是一个正确的修复;但是,我假设这会因不同的屏幕分辨率而被取消,但在 jsfiddle 中它看起来是正确的。

JSFiddle

关于html - 无法将我的福利等级移到右边,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32700810/

相关文章:

html - 有没有一种特殊的方法可以输入图标字体 URL?我的只是显示为 unicode

python - Django 模板不会将值输出到 HTML 表格单元格

javascript - 父级可调整大小时,如何防止嵌套DIV的内容溢出父级?

Jquery 切换添加 z-index

javascript - JavaScript 中的目标元素

javascript - 更改日期时间选择器下拉小部件内的字形图标颜色

html - 如何在两边 20% 边距的中心显示我的页面?

php - 如何从 Woocommerce 产品小部件中删除要点

c# - 有没有浏览器会自动添加内联CSS的场景?

jquery - 从选择菜单中拉取选项