【问题标题】:Placing the button in my page将按钮放在我的页面中
【发布时间】:2014-02-13 05:41:00
【问题描述】:

实际上,我是网页设计的新手,我将创建自己的社交网络,我正在使用 Angelsmood.com music social network 的惊人布局。

除了我无法将“注册”按钮放在正确的位置之外,一切都可以设计;它的右侧有很多边距。问题是我的 CSS 代码没有边距。这是我的代码:

<div id="header_register">                  
    <a href="~/register/">Sign Up</a> 

    <div>
    Artists and their true fans are human angels.
    Find them, connect with them and become one of them.
    </div>

</div>

这是 CSS:

#header_register {
position: relative;
font-size: 12px;
}

#header_register a {
display: block;
height: 30px;
line-height: 30px;
background: ##810101;
color: #fff;
font-weight: bold;
font-size: 14px;
float: left;
text-decoration: none;
border: 1px #508F54 solid;
}

请帮我解决这个问题。

【问题讨论】:

  • 请发布问题的 jsfiddle ( jsfiddle.net ),以便更容易发现问题。
  • 我认为你忘记了 CSS。
  • “问题是我的 CSS 代码没有边距。”。还是应该发。更好的是小提琴
  • 我添加了css。请重新检查。
  • 您将注册按钮浮动到左侧

标签: html css button margin


【解决方案1】:

我做了一个小提琴,并试图根据您提供给我们的信息尽我所能解决您的问题。

jsfiddle

我所做的事情...取出您的 line-height 并将链接移到 div 之后,这样您就不必使用它了...然后我将 margin: 0 auto 放在 &lt;a&gt; 标记的中心。

而不是float: left;

我把它拿出来,在&lt;a&gt; 标签中添加了一个width,所以它没有跨越屏幕的宽度。

如果您需要它以我已说明的不同方式运行,请询问,我将在我发布的小提琴上向您展示。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-05
    • 1970-01-01
    相关资源
    最近更新 更多