The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> CSS Help
|
Float isn't floating, it's sinking! ;-)
Discuss Float isn't floating, it's sinking! ;-) in the CSS Help forum on Dev Shed. Float isn't floating, it's sinking! ;-) Cascading Style Sheets (CSS) forum discussing all levels of CSS, including CSS1, CSS2 and CSS Positioning. CSS provides a robust way of applying standardized design concepts to your web pages.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

December 19th, 2012, 07:53 PM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 7
Time spent in forums: 45 m 27 sec
Reputation 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???
|

December 19th, 2012, 07:55 PM
|
 |
Contributing User
|
|
Join Date: Aug 2011
Location: The Pleiades
|
|
|
Do you have a link to your site or the php?
Regards,
NM.
__________________
"WERE NOT WORTHY!"
"WERE NOT WORTHY!"
|

December 19th, 2012, 07:56 PM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 7
Time spent in forums: 45 m 27 sec
Reputation 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> </p>
<p>$info</p>
<p><a href=\"http://$link\" target=\"_blank\">$linkTxt</a></p>
<p> </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.
|

December 19th, 2012, 08:02 PM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 7
Time spent in forums: 45 m 27 sec
Reputation Power: 0
|
|
Quote: | 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.
|

December 19th, 2012, 08:10 PM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 7
Time spent in forums: 45 m 27 sec
Reputation Power: 0
|
|
Quote: | 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?
|

December 19th, 2012, 10:45 PM
|
 |
CSS & JS/DOM Adept
|
|
Join Date: Jul 2004
Location: USA
|
|
|

December 19th, 2012, 11:11 PM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 7
Time spent in forums: 45 m 27 sec
Reputation Power: 0
|
|
Quote: | 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.
|

December 19th, 2012, 11:12 PM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 7
Time spent in forums: 45 m 27 sec
Reputation Power: 0
|
|
Quote: | 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.
|

December 19th, 2012, 11:27 PM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 7
Time spent in forums: 45 m 27 sec
Reputation 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 :-)
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|