首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法将我的特权类移到右侧

无法将我的特权类移到右侧
EN

Stack Overflow用户
提问于 2015-09-22 01:03:10
回答 1查看 56关注 0票数 0

我试着注释掉我所有的css,除了perks类,我仍然不能通过改变页边距让它向右移动。

我是css的新手,所以我可能犯了一个明显的错误,但我花了几个小时尝试调试,因为它不是我CSS其余部分的边缘部分,也不是我的任何其他类干扰额外功能的部分。

Fiddle

代码语言:javascript
复制
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;
}
代码语言:javascript
复制
<!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>

EN

回答 1

Stack Overflow用户

发布于 2015-09-22 01:30:02

我把它放在了这个中心:

代码语言:javascript
复制
.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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32700810

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档