#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    7
    Rep Power
    0

    Float isn't floating, it's sinking! ;-)


    Ok...

    Never had this happen before and I'm by no means a CSS expert.

    I develop in php and this current application is heavy on MySQL calls.

    So for the medtext fields I'm adding a nl2br to make sure I maintain carriage returns from what was entered.

    My problem with the CSS is I have an image to the right. With that php code it adds two line breaks for the carriage returns. Those breaks kill the float so the next "paragraph" will not appear until the bottom of the image.

    Obviously I need to clear something. I've tried clearing both on the image to no avail.

    Both text and images are in the same div of course.

    I'm beginning to think it worth my time to just make two divs. one for the pic and one for the text.

    What needs to be cleared???
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Location
    The Pleiades
    Posts
    299
    Rep Power
    9
    Do you have a link to your site or the php?

    Regards,

    NM.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    7
    Rep Power
    0
    I figure you're going to want to see the code. The CSS first:

    Code:
    .img_event {
    	clear: both;
    	float: right;
    	margin-top: 10px;
    	margin-left: 20px;
    	margin-bottom: 20px;
    }
    #events_holder {
    	min-height: 180px;
    }
    Now the code after the variables are set and my loop begins...

    PHP Code:
    $info nl2br($info); 
            echo 
    "<div class='clear_all'></div><div id='events_holder'><img src='/NewOrchard/$pic' class='img_event' />
            <h7>
    $title</h7>
            
            <p>
    $date</p>
            <p>&nbsp;</p>
            <p>
    $info</p>
            <p><a href=\"http://
    $link\" target=\"_blank\">$linkTxt</a></p>
            <p>&nbsp;</p>
            <p><hr /></p>
            </div>"

    I went ahead and threw in the variable with the nl2br setting since that's the one I'm having trouble with.

    And so it's not confusing... $pic is just the name of the image in the uploads folder where it went when the event was created.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    7
    Rep Power
    0
    Originally Posted by Nanomech
    Do you have a link to your site or the php?

    Regards,

    NM.
    I do. The page I'm working on currently is here:

    well...says new users can't post URL's.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    7
    Rep Power
    0
    Originally Posted by Nanomech
    Do you have a link to your site or the php?

    Regards,

    NM.
    Since I can't post a URL (goofy rule) look at the php code above and just before $pic you will see /NewOrchard/

    Just before that do the usual go to web page stuff but add orchardmidland. Then instead of $pic put in orchard_youth dot php.

    Make sense? ;-) How's that for a work around?
  10. #6
  11. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,128
    Rep Power
    4304
    Here's the link: http://www.orchardmidland.com/NewOrc...hard_youth.php

    Welcome to DevShed Forums, dpiearcy.

    As you found out new users are restricted from posting URLs until they have made 5 posts. You didn't need to obfuscate your URL to that extreme degree, you can simply get around the filter by leaving out the "http://" and putting a space before each ".". Yes this rule is annoying, but the administrators say it's necessary for limiting spam.

    Have you checked to make sure your pages don't contain errors? (Many CSS3 properties will appear as errors, even when they aren't really errors.)
    http://validator.w3.org/
    http://jigsaw.w3.org/css-validator/
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    7
    Rep Power
    0
    Originally Posted by Kravvitz

    Have you checked to make sure your pages don't contain errors? (Many CSS3 properties will appear as errors, even when they aren't really errors.)
    Thank you for posting my link for me. Should be getting to about 5 now if replies count :-) Trust me, I fight stupid spam all the time on forms and such. I HATE Captcha so you should see my php filter functions I run everything through just to submit a stupid contact form.

    But I digress, no I had not ran it through those. I did run the php code (of course it read the rendered html) and it came back with a bunch of "alt name not specified" for images. I do that later in the developing process. I know...I know.. SEO.

    I ran the CSS through there and it came back with no errors.

    But great links. I book marked them. You never know when you forget to close a link or something. That's going to be a very handy tool.
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    7
    Rep Power
    0
    Originally Posted by dpiearcy
    Thank you for posting my link for me. Should be getting to about 5 now if replies count :-)
    How about that? That last reply made 5 so now I can post URL's!

    Doing the happy dance.
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    7
    Rep Power
    0
    Now that I can post URL's the page in question is indeed orchard midland

    The events at the bottom you will notice with php adding two line breaks for the carriage return the second paragraph will not float. It drops below the image.

    BUT... while you're there, just for fun I had an idea. Click on the home link on the top menu. This will, of course, take you home (index). So I thought...if you were on the home page why would you click this link?

    So with php I decided to find out what page they were on and write and if and else if statement and declaring a variable of page. Then, if you are on the home page it equals one thing or if you're on any other page it will equal index.php and function correctly.

    So once you're on the home page, hit that home button. I thought it was funny. Not sure what the church I'm developing this page for will think though :-)

IMN logo majestic logo threadwatch logo seochat tools logo