CSS无法对div类起作用

时间:2013-01-03 03:02:43

标签: html css

我正在试图找出为什么我的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旁边浮动,但是甚至背景颜色都不起作用。请给我一些见解。 谢谢!

2 个答案:

答案 0 :(得分:0)

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

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

答案 1 :(得分:-1)

我为你做了一个简单的布局。希望这是你要找的东西:codepen