Welcome to Dream.In.Code
Become an Expert!

Join 150,171 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,258 people online right now. Registration is fast and FREE... Join Now!




css boxes

 
Reply to this topicStart new topic

css boxes

realNoName
25 Aug, 2008 - 03:11 PM
Post #1

D.I.C Regular
***

Joined: 4 Dec, 2006
Posts: 311



Thanked: 5 times
My Contributions
am trying to make a page with 2 columns and on each side there are multiple boxes kind of like a news box any way it looks like it works some times but depending on the length of the text it might get messed up. i cant really upload a live example because it pulls the info from a database but i took 2 screen shots to show what it is doing.

css
*note i changed the background color of col-one to help me see whats going on
CODE
#col-one {
    float: left;
    background-color: red;
    width: 47%;
    margin: 10px 0 0px 10px;
}

#col-two {
    float: right;
    width: 47%;
    margin: 10px 10px 0px 0;
}

.content {
    padding: 15px 15px 15px 15px;
    background-color:    #FFFFFF;
    border: 1px solid #528489;
}

.title {
    height: 20px;
    padding: 10px 0 0 10px;
    background-color:    #0a328c;
    letter-spacing: 1px;
    font-size: 11px;
    color: #FFFFFF;
}

.date {
    float: right;
    position: relative;
    top: -15px;
    margin-right: 10px;
    font-size: 12px;
}
.options{
    float: right;
    border: 1px solid #528489;
    border-top-width: 0px;
    letter-spacing: 1px;
    padding: 0 10px 0 10px;
}


php that prints out the info, col-two is the same code
CODE
    echo "<div id=col-one>
          <div class=title>$title
        <div class=date>$date</div>
          </div>

          <div class=content>$message</div>
          <div class=options> edit | delete</div></div>";


Attached Image - the way it should look
Attached Image - bad
User is offlineProfile CardPM
+Quote Post

BetaWar
RE: Css Boxes
25 Aug, 2008 - 03:19 PM
Post #2

#include <soul.h>
Group Icon

Joined: 7 Sep, 2006
Posts: 2,304



Thanked: 101 times
Dream Kudos: 1275
My Contributions
Why not print the data like so:

CODE

echo "<div id='col-one'>";
//DO THE LOOP HERE {
echo "<div class=title>$title
        <div class=date>$date</div>
          </div>

          <div class=content>$message</div>
          <div class=options> edit | delete</div>";
// END LOOP HERE }
echo "</div>";


and then do the same thing for col 2?
User is offlineProfile CardPM
+Quote Post

realNoName
RE: Css Boxes
25 Aug, 2008 - 03:29 PM
Post #3

D.I.C Regular
***

Joined: 4 Dec, 2006
Posts: 311



Thanked: 5 times
My Contributions
that was the way i originally did it but the only problem i had with that was some of the content text is longer and others will be just a line or two and for what am doing it for doesn't mater what order they are in so i was going to try and put some sorting into what side the text should go depending on the length so it will even out the page a little

This post has been edited by realNoName: 25 Aug, 2008 - 03:34 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 03:20AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month