p标签上的对齐文本

时间:2013-10-17 23:05:23

标签: html css

我创建了一个包含一些文本和图像的html页面。我想将文本对齐放在我的页面中。这是我所有的html来源:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Untitled Page</title>
        <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
        <link rel="stylesheet" href="style.css" />
        <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
        <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
        <style>
            body {
                font-family: "Trebuchet MS", "Helvetica", "Arial",  "Verdana", "sans-serif";
                font-size: 80%;
            }
            br {
                display: block;
                margin: 0px 10px 0px 10px;
            }
        </style>
    </head>
    <body>
        <p style="background: url(header.png) no-repeat #ffffff; width: 438px; height: 29px; margin: 130px auto; margin-bottom: 0px;">
        </p>
        <p style="background: url(bg.png) no-repeat #ffffff; text-align: left; width: 438px; height: 438px; margin: 0px auto;">
            <img id="logo" src="1.png" />
            <span style="width: 400px; margin: 0px 10px 0px 10px;">
            Google Inc.<br />
            Copyright &copy; 2006-2013Google Inc. All Rights Reserved.
            <br />
            Portions of this software were licensed from third parties as described at :
            <a style="margin-left:8px;" href="http://www.google.com/support/chrome/bin/answer.py?answer=100336">http://www.google.com/support/chrome/bin/answer.py?answer=100336</a>.
            </span>
            <br />
            <span style="float: right; padding: 0px 10px 0px 10px;"><input type="button" value="Download Now" /><input type="button" value="Ok" /></span>
        </p>
    </body>
</html>

我在Second P标签上的文字(背景为bg)不对齐。我该怎么解决?看到这个:http://labonline.somee.com/new.htm

1 个答案:

答案 0 :(得分:1)

尝试使用“float:left;”在

<span style="float: left;width:400px;margin:0px 10px 0px 10px;">