html - "footer"div 中的响应式 h3 元素

标签 html css

我正在尝试使用页眉、内容和页脚对我的页面进行“结果”划分。

页眉和内容都按我预期的方式工作,但我似乎无法让页脚中的 h3 元素在 div 上右对齐。如果我做;当我调整屏幕大小时它会中断。另一方面,result_header 似乎正常下降。

无 asp 的 html 标记如下。

   <div id="results">
          <div id="result_header">
            <h3>Tax Estimator Results</h3>
              <asp:Label AssociatedControlID="TugDropDown"
                runat="server" CssClass="tugLabel">
              <%=SrcTugList.Count %>  Taxing Unit Groups
              </asp:Label>
              <asp:DropDownList ID="TugDropDown"
                DataTextField="Desc"
                DataValueField="CodeID"
                runat="server" />
            </div>
            <!-- results go here, ignored since it's asp mostly -->
            <div id="result_footer">
            <h3> Total Estimate: </h3> <!-- This is what I want to right align/float on the right border of this div, it is not doing what I expect. -->
            </div>
        </div>


.tugLabel {
  color: #fff;
  display: inline;
  position: absolute;
  padding: 0;
  margin: 0;
  width: 100px;
  right: 32%
}

#results select {
  width: 30%;
  padding: 0;
  margin: 0;
  position: absolute;
  right: 2%;
  display: inline;
}

.tugResult{
  position: relative;
  padding: 5%;
  margin: 1%;
}

#result_footer {
  color: #fff;
  padding: 2%;
  position: relative;
  background-color: #9bc5ee;
}

#result_footer h3 {
  color: #fff;
  font-size: 1.3em;
  display: block;
  position: absolute;
  top: 2%;
  bottom: 2%;
  right: 5%;
  float: right;
}

最佳答案

我希望我能正确理解这个问题。您希望 h3 位于页脚 div 的右侧,对吗? 与其将 h3 向右浮动,不如使用 text-align: right 怎么样?

关于html - "footer"div 中的响应式 h3 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22104751/

相关文章:

javascript - 我如何区分自动生成的链接与 JavaScript?

css - 根据其 Prop 有条件地在组件上应用实用程序类的最佳方法

html - 如何在 CSS 中水平拉伸(stretch)图像并在 HTML 中显示 3 个单独的图像

css - span 中的文本在使用 flex 和 writing-mode 的 Firefox 中消失

internet-explorer-8 - CSS 圆 Angular IE8 和 IE7

css - 背景图像未拉伸(stretch)

html - 使用 Bootstrap 填充显示窗口的顶部和全高

javascript - 输入元素上的 onClick 与 onFocus

javascript - 如何从页面获取 HTML 源代码?

javascript - 未捕获的范围错误 : Maximum call stack size exceeded