在页面上定位图像

时间:2015-06-29 17:12:02

标签: html css

我在ASP.NET中有一个图像,我希望我能够非常清楚地解释这一点,以便你能给出非常明确的答案。

我的主表格有以下设置:

.page
{
    width: auto;
    background-color: #fff;
    margin: 0px auto 0px auto;
    border: 1px solid #496077;
    height: auto;
}

.header
{
    position: relative;
    margin: 0px;
    padding: 0px;
    background: #4b6c9e;
    width: 100%;
}

.header h1
{
    font-weight: 700;
    margin: 0px;
    padding: 0px 0px 0px 20px;
    color: #f9f9f9;
    border: none;
    line-height: 2em;
    font-size: 2em;
}

.main
{
    padding: 0px 12px;
    margin: 12px 8px 8px 8px;
}

.leftCol
{
    padding: 6px 0px;
    margin: 12px 8px 8px 8px;
    width: 200px;
    min-height: 200px;
}

.footer
{
    color: #4e5766;
    padding: 8px 0px 0px 0px;
    margin: 0px auto;
    text-align: center;
    line-height: normal;
}

我有一个"联系我们"页面,其中包含有关页面左侧边缘人员的每个条目的可变信息(姓名,地址,联系信息等)。我想定位一个图像,该图像只是为某个人提供的最右边信息的几个像素,我希望图片的heightxwidth根据文本的高度而变化(如果用户要输入更多行获取每个联系人的信息等。)

如何获得具有此定位的图像?到目前为止,我已经能够在屏幕的最右侧获得图像,但这并不好,因为我希望在表格上有更多空格的2列联系信息。

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<h1>Contact Information<b><img align="left" alt="pic" class="bold" 
        src="profilepic.jpg" 
        style="width: 150px; height: 150px; float: right;" vspace="0" /></b></h1>
<b><h2>adsf</h2>
adsf</b> <br />
asdf<br />
asdf</br>
asdf <br />
asdf <br />
asdf
</asp:Content>

1 个答案:

答案 0 :(得分:0)

你有没有考虑过用过桌子?您可以使用类来设置行宽,文本对齐,垂直对齐以及所有其他样式yadda yadda的样式;或者你选择。但这会为每个人设置列和行....

<table class="table">
      <tr class="tableRow">
            <td class="tableDataLeft">
             Some Persons info Number 1
             </td>
            <td class="tableDataMiddle">
             Person Number 1's second column of info
             </td>
            <td class="tableDataRight">
             Person number 1's image...<img src/>
            </td>
      </tr>
      <tr>
            <tdclass="tableDataLeft">
             Some Persons info Number 2
             </tdclass="tableDataLeft">
            <td class="tableDataMiddle">
             Person Number 2's second column of info
             </td>
            <td class="tableDataRight">
             Person number 2's image...<img src/>
            </td>          
      </tr>
</table>
相关问题