0

我试图弄清楚为什么我的 css 不能在 .build 类 div 上工作。我不知道我哪里出错了。HTML:

<!DOCTYPE HTML>
<html>
<head>
        <title> Build Projects

    (bryan22)

    </title>
<link href = 'obpstyle.css' rel = 'stylesheet' type = 'text/css' />
</head>
<body>
    <h1> Build Projects </h1>   
    <strong> bryan22 </strong>
    <a class = 'navbut' href = 'index2.php'>Home</a>
    <a class = 'navbut' href = 'obpmembers.php'>Members</a>
    <a class = 'navbut' href = 'obpfriends.php'>Friends</a>
    <a class = 'navbut' href = 'obpmessages.php'>Messages</a>
    <a class = 'navbut' href = 'obpmembers.php?view=bryan22'>Profile</a>
    <a class = 'navbut' href = 'obpbrowse.php'>Browse Builds</a> 
    <a class = 'navbut' href = 'obplogout.php'>Log Out</a>

    <div class = 'showProfile'> <h3 class = 'heading'>Your Page</h3>
        <div id = 'profimg'>
            <img src = '../website/users/bryan22/bryan22.jpg' />
        </div>
        <p class = 'usertext'>
            I'm Bryan!
        </p>
        <form action = '' method = 'post'>
            <input type = 'submit' name = 'edit' value = 'Edit' />
        </form>
    </div>
    <div class = 'builds'>
        <a href = 'obpbuilds.php?view=bryan22&build=The Danger Ranger'>
            <strong>The Danger Ranger</strong>
            <br />
        </a>
<img src = '../website/users/bryan22/The Danger Ranger/The Danger Ranger.jpg' />
    </div>
    <div class = 'builds'>
        <a href = 'obpbuilds.php?view=bryan22&build=450 monster'>
            <strong>450 monster</strong>
            <br />
        </a>
    <img src = '../website/users/bryan22/450 monster/450 monster.jpg' />
    </div>
    <a href = 'obpmessages.php?view=bryan22'> Your Messages</a> 
    <a href = 'obpfriends.php?view=bryan22'> Your Friends</a></body>
</html>

CSS:

.builds
{
float:right; !important;
font-family:helvetica;
background-color:red !important;
}
.showProfile
{
/*float:left;*/
background-color:red
}

我真的只是希望构建 div 浮动在 showProfile div 旁边,但甚至背景颜色都不起作用。请给我一些见解。谢谢!

4

2 回答 2

0

使用应用类创建 div 的 PHP 循环应该没有问题。CSS 应该被拾取并用于循环的每次迭代。

如果 HTML/CSS 在您的小提琴中正常工作,正如您所评论的,那么 HTML、CSS 或 PHP 肯定存在其他问题,导致代码格式错误或被取代。

于 2013-01-03T07:57:09.453 回答
-1

我为你做了一个简单的布局。希望这是您正在寻找的:codepen

于 2013-01-03T03:22:49.713 回答