GVKun编程网logo

html – 使用css将按钮与表中的行对齐(css如何对按钮进行设置)

18

如果您想了解html–使用css将按钮与表中的行对齐和css如何对按钮进行设置的知识,那么本篇文章将是您的不二之选。我们将深入剖析html–使用css将按钮与表中的行对齐的各个方面,并为您解答css如

如果您想了解html – 使用css将按钮与表中的行对齐css如何对按钮进行设置的知识,那么本篇文章将是您的不二之选。我们将深入剖析html – 使用css将按钮与表中的行对齐的各个方面,并为您解答css如何对按钮进行设置的疑在这篇文章中,我们将为您介绍html – 使用css将按钮与表中的行对齐的相关知识,同时也会详细的解释css如何对按钮进行设置的运用方法,并给出实际的案例分析,希望能帮助到您!

本文目录一览:

html – 使用css将按钮与表中的行对齐(css如何对按钮进行设置)

html – 使用css将按钮与表中的行对齐(css如何对按钮进行设置)

我正在尝试开发一个可用于编辑数据库信息的表(对于非数据库用户).这是我的(对于 HTML):
<table id="myTable" cellspacing='0'>
    <tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr>
    <tr id='1'><td>1</td><td>1</td><td>2</td>
    <td>
     <div>
        <ahttps://www.jb51.cc/tag/dis/" target="_blank">display:block;position:relative;left:20px">-</a>
     </div>
    </td>

    </tr>
    <tr id='2'><td>3</td><td>5</td><td>8</td></tr>
    <tr id='3'><td>13</td><td>21</td><td>34</td></tr>
    <tr id='4'><td>55</td><td>89</td><td>144</td></tr>
    <tr id='5'><td>233</td><td>377</td><td>610</td></tr>
</table>
<inputtype="button" value="+">
</table>

这是CSS:

table {
    background: #E0F5F9;
    margin-left: 20px;
    margin-right: 20px;
    margin-top: 20px;
    margin-bottom: 0px;
    border-style: solid;
    border-width: 2px;
    border-color: #1C9CBC;  
    -moz-border-radius:10px;
    -webkit-border-radius:10px;
    border-radius:10px;
}

table th {
    padding:4px 10px;
    background: #A8A8A8;
}

table td {
    background:#fff;
    padding:2px 10px 4px 10px;
}

div.editableTable {
    display: inline;
}

input.addRow {
    margin-left: 10px;
    border: solid 2px #1C9CBC;
    -moz-border-radius:10px;
    -webkit-border-radius:10px;
    border-radius:10px;
    padding-left: 5px;
    padding-right: 5px;
    background: #A8A8A8;

}

table tr.even td {background:#98E6F9}
table tr td {
    background: #E0F5F9;
}

table tr.editing td {
    background: #FF0000;
}

table tr.selectedEven td {
    background: #98E6F9;
    border-left-width: 0px;
    border-top-width: 1px;
    border-bottom-width: 1px;
    border-right-width: 0px;
    border-style: solid;
    border-color: #03C100;
}

table tr.selectedEven td:first-child {
    border-left-width: 1px;
    border-top-width: 1px;
    border-bottom-width: 1px;
    border-right-width: 0px;
    border-style: solid;
    border-color: #03C100;
    -moz-border-radius-topleft:10px;
    -moz-border-radius-bottomleft:10px;
    -webkit-border-bottom-left-radius:10px;
    border-bottom-left-radius:10px;
    -webkit-border-top-left-radius:10px;
    border-top-left-radius:10px;
}

table tr.selectedEven td:last-child {
    border-left-width: 1px;
    border-top-width: 1px;
    border-bottom-width: 1px;
    border-right-width: 0px;
    border-style: solid;
    border-color: #03C100;
    -moz-border-radius-topright:10px;
    -moz-border-radius-bottomright:10px;
}

table tr.selectedEven td:last-child {
    border-left-width: 0px;
    border-top-width: 1px;
    border-bottom-width: 1px;
    border-right-width: 1px;
    border-style: solid;
    border-color: #03C100;
}

table tr.selected td {
    /* background: #E0F5F9; */
    border-left-width: 0px;
    border-top-width: 1px;
    border-bottom-width: 1px;
    border-right-width: 0px;
    border-style: solid;
    border-color: #03C100;
}

table tr.selected td:first-child {
    border-left-width: 1px;
    border-top-width: 1px;
    border-bottom-width: 1px;
    border-right-width: 0px;
    border-style: solid;
    border-color: #03C100;
    -moz-border-radius-topleft:10px;
    -moz-border-radius-bottomleft:10px;
    -webkit-border-bottom-left-radius:10px;
    border-bottom-left-radius:10px;
    -webkit-border-top-left-radius:10px;
    border-top-left-radius:10px;
}

table tr.selected td:last-child {
    border-left-width: 1px;
    border-top-width: 1px;
    border-bottom-width: 1px;
    border-right-width: 0px;
    border-style: solid;
    border-color: #03C100;
    -moz-border-radius-topright:10px;
    -moz-border-radius-bottomright:10px;
}

table tr.selected td:last-child {
    border-left-width: 0px;
    border-top-width: 1px;
    border-bottom-width: 1px;
    border-right-width: 1px;
    border-style: solid;
    border-color: #03C100;
}

table tr:last-child td:first-child {
    -moz-border-radius-bottomleft:10px;
    -webkit-border-bottom-left-radius:10px;
    border-bottom-left-radius:10px}

table tr:last-child td:last-child {
    -moz-border-radius-bottomright:10px;
    -webkit-border-bottom-right-radius:10px;
    border-bottom-right-radius:10px
}

而且,这是它的样子:

这很好,除了右侧的删除按钮离行有点偏.这意味着一旦我们添加~13或14行,删除按钮就会从它将要删除的行中移开.因此,用户不清楚当他们点击删除时将确切删除哪一行.

我想找到一些方法,允许我使用CSS将按钮(或者,在这种情况下,几个按钮)与所讨论的表的行对齐.这可能吗?我最初(没有成功)尝试在没有第二个表的情况下执行此操作,但这导致了我当前的情况,其中我有一个用于对齐目的的表仅在实际包含数据的表的右侧.

我面临的一个大问题是,我似乎无法弄清楚如何将某些东西与表格中的行对齐.我可以用jQuery做到这一点,但这看起来像是用锤子敲打螺丝.我承认我在编程方面不像CSS那样经验丰富,所以我通常倾向于查看编程答案.有人可以帮我弄清楚如何正确对齐这些按钮吗?

谢谢!

解决方法

您可以尝试将按钮放在最后一个< td>内.在行中然后将其浮动到右边并提供足够大的负右边距以使其在表外;你还需要在桌子上有一个正的右边距,以确保按钮有空间.

例如:

<table>
    <tbody>
        <tr>
            <td>kdsjfkdsl fds</td>
            <td><span>X</span>Appropriately architect 24/365 internal or "organic" sources after fully tested portals. Monotonectally Leverage existing an expanded array of action items before resource maximizing growth strategies. Proactively drive orthogonal ROI before sustainable relationships.</td>
        </tr>
        <tr>
            <td>2193485798435</td>
            <td><span>X</span>Enthusiastically deploy team building data with e-business internal or "organic" sources. Enthusiastically negotiate diverse models for transparent communities. Intrinsicly disseminate just in time markets before vertical paradigms. Authoritatively brand performance based web-readiness for error-free growth strategies. Energistically empower customer directed markets with quality data. distinctively productivate backward-compatible potentialities before prospective technology.</td>
        </tr>
    </tbody>
</table>

还有一点CSS(用着色来清楚地显示所有内容):

table {
    margin-right: 2em;
}
td {
    padding: 5px;
    border: 1px solid green;
}
span.killer {
    float: right;
    margin-right: -1.5em;
    color: red;
    font-weight: bold;
}

并且jsfiddle:http://jsfiddle.net/ambiguous/RE8rK/

我从空中挑选了边距以说明效果,我将为您计算正确的值.

css – 如何将按钮与引导程序中行/列的底部对齐?

css – 如何将按钮与引导程序中行/列的底部对齐?

我有4列的行,每列有一个标题和一些文本.大多数列具有相似数量的文本,并按下其列中的按钮以匹配其余列.但是,一列的文本较少,并且没有按下按钮足够远.

有没有办法将按钮对齐到行的底部?我想实现这一点并同时保持响应,所以当屏幕较小时它看起来像这样:

这是我刚才的页面标记:

<div>
  <div>
    <div>
      <h2>heading</h2>
      <p>text here</p>
      <p><ahref="#" role="button">View details >></a></p>
    </div>
    <div>
      <h2>heading</h2>
      <p>text here</p>
      <p><ahref="#" role="button">View details >></a></p>
    </div>
    <div>
      <h2>heading</h2>
      <p>less text here</p>
      <p><ahref="#" role="button">View details >></a></p>
    </div>
    <div>
      <h2>heading</h2>
      <p>text here</p>
      <p><ahref="#" role="button">View details >></a></p>
    </div>
  </div>
</div>

解决方法

有几种方法可以做到:

>给容器一个固定的高度.这并不理想,因为为了使它看起来不错,你必须为每个断点设置不同的高度.
您还需要将按钮设置为position:absolute,bottom:0并添加一些底部填充/边距.
>使用一些javascript来匹配高度,使用像match height这样的东西.你还需要像上一点那样设置位置.
>添加一行并在4个新cols中重复按钮.然后使用bootstraps responsive classes显示或隐藏原始按钮和新按钮.

html – CSS将div 1对齐到center,div 2对齐到右对齐

html – CSS将div 1对齐到center,div 2对齐到右对齐

请看看 http://jsfiddle.net/zygnz/1/

<div>
        <div>
            LEFT
        </div>
        <div>
            RIGHT
        </div>
</div>

我们可以将左侧块对齐到页面的中心,将右侧对齐在剩余的位置..?

解决方法

如果你的意思是将div 1集中到剩余的空间(容器 – div2),你可以使用text-align:center和float div 2为容器设置样式.

否则我会使用绝对位置.

html – 仅使用CSS将图片制作成圆形视图

html – 仅使用CSS将图片制作成圆形视图

以下代码有效
<div>
<img src="avatar.png" alt="Squared Avatar" />
</div>

但这些代码不会,

<div>
<img src="avatar.png" alt="Squared Avatar" />
</div>

我只是想知道为什么宽度和高度必须是px才能达到这样的效果,而不是百分比?我知道使用百分比比使用px更灵活.

这是jsfiddle,如果我们调整结果窗格的大小,您可以看到P1按预期自动调整使用百分比,所以问题是这100%来自哪里?我认为100%表示图片的宽度和高度而不是框架.

=====更新:2014年12月26日======

谢谢你们,@ jmore009回答了这个问题.

我忘了div从其父div继承宽度和高度,所以100%来自body元素,默认情况下浏览器调整大小时会调整大小.
这是我最新的jsfiddle.

解决方法

百分比在父母身上发挥作用.它说100%的其他东西或50%的其他东西,如果你没有定义父亲的身高和/或宽度(最高级别的父亲是身体和html),那么你没有什么可以解决的.

html – 使图像在文本后面,并使用css将其保留在中央

html – 使图像在文本后面,并使用css将其保留在中央

我正在创建一个网页,我有一个图像,我想放在中心,然后在该图像的顶部,我想要有输入框和标签和提交按钮.

我试图使用css

img.center
{
    z-index:-1;
}

但这不行.当我将代码更改为

img.center
{
    position:absolute;
    left:0px;
    top:0px;
    z-index:-1;
}

如果使图像落后,但是,因为我使用左:0px和顶部:0px …它将图像放在位置0,0 ..但我想让图像留在中心.

为了保持图像在中心,我有< div align =“center”>标签.

有没有,我可以保持图像在中心,使它走在后面吗?

我的.html页面看起来像这样(我试图为我的div标签有一个背景图像,但没有图像出现在那里)

<html>
<head>
<title>Question of the Week</title>
<style type="text/css">
    body
    {
        background-image:url('images/background.jpg');
        background-repeat:repeat-x;
    }

    .container
    {
    background-image:url('images/center.jpg');
    background-repeat:no-repeat;
    }
    td.cntr {padding-top:50px;}
</style>
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">

    <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td><div align="left"><img src="images/logo.jpg"></div></td>
                    <td></td>
                    <td><div align="right"><img src="images/right_logo.jpg"></div></td></tr>
            </table>
        </tr>
        <tr>
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <div id="container">
                            <input name="Box" type="textBox" />
                            <input name="Box" type="textBox" />
                            <input name="submit" type="submit" />
                        </div>
                    </td>
                </tr>
            </table>
        </tr>
    </table>
</body>
</html>

解决方法

那么把你的图像放在你的网站/容器的后面,并放上你想要的东西.所以说你有:
<div id="container">
   <input name="Box" type="textBox" />
   <input name="Box" type="textBox" />
   <input name="submit" type="submit" />
</div>

这是在你的代码,你的CSS将看起来像:

#container {
    background-image:url(yourimage.jpg);
    background-position:center;
    width:700px;
    height:400px;
}

为了这个工作,你必须将高度和宽度指定为特定的值(即没有%),我可以更具体地帮助你,如果你需要它,但我需要更多的信息.

我们今天的关于html – 使用css将按钮与表中的行对齐css如何对按钮进行设置的分享已经告一段落,感谢您的关注,如果您想了解更多关于css – 如何将按钮与引导程序中行/列的底部对齐?、html – CSS将div 1对齐到center,div 2对齐到右对齐、html – 仅使用CSS将图片制作成圆形视图、html – 使图像在文本后面,并使用css将其保留在中央的相关信息,请在本站查询。

本文标签: