-1

嗨,我想知道是否可以将 div 内的文本和图像向右对齐?因为 div 中的文本会更改并读出我网站上每个成员个人资料名称的名称,所以当我尝试这样做时,文本与图像重叠?

.prof-content-box-left-lower {
    /* [disabled]height: 200px; */
    /* [disabled]position: relative; */
    margin-top: 25px;
    margin-bottom: 5px;
    margin-right: 18px;
    width: 200px;
    position:relative;
    float:right;
    text-align:right;
    z-index:90;
4

1 回答 1

0

我想你可能只是想让图像正确浮动。请参阅此示例中图像标签上的内联 CSS。

 <html>
    <head>
        <style>
            .prof-content-box-left-lower {
                /* [disabled]height: 200px; */
                /* [disabled]position: relative; */
                margin-top: 25px;
                margin-bottom: 5px;
                margin-right: 18px;
                width: 200px;
                position:relative;
                text-align:right;
                z-index:90;
                background: #CCCCCC;
            }
        </style>
    </head>
    <body>
        <div class = "prof-content-box-left-lower">
            <img src = "http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon.png" style = "float: right" width = 100 height = 100>
            my example text
            <div style = "clear: both"></div> <!-- this line clears the float so you can stack these divs, which I expect you probably will-->
        </div>
        <div class = "prof-content-box-left-lower">
            <img src = "http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon.png" style = "float: right" width = 100 height = 100>
            my example text
            <div style = "clear: both"></div>
        </div>
    </body>
</html>
于 2013-03-16T20:56:40.913 回答