Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
float:left; won't work
Old 12-28-2008, 05:48 PM float:left; won't work
Novice Talker

Posts: 5
Trades: 0
I'm writing a simple page over here. I want my text aligned beside my image, but I can only get it to show up BELOW my image.

Relevant HTML:

Code:
<p><a class="hasImage" href="http://www.amazon.com/dp/1440467005/ref=nosim?tag=lukeprogcom-20"><img class="alignleft" src="/images/front-separated thumbnail.png"></a><b>Have you ever wanted to publish your own book?</b></p>
Relevant CSS:

Code:
img.alignleft {
  float: left;
}

a.hasImage { border: 0 none }
a:link.hasImage { border: 0 none }
a:visited.hasImage { border: 0 none }
a:active.hasImage { border: 0 none }
a img { border: none }
Why doesn't this work? I keep reading CSS documentation (for example) and it looks like this should work, but it doesn't.

Many thanks.
lukeprog is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-28-2008, 06:00 PM Re: float:left; won't work
Decaf's Avatar
Ultra Talker

Posts: 489
Name: Adam
Trades: 0
Try:

HTML Code:
<p class="hasImage"><a class="hasImage" href="http://www.amazon.com/dp/1440467005/ref=nosim?tag=lukeprogcom-20"><img class="alignleft" src="/images/front-separated thumbnail.png"></a><b>Have you ever wanted to publish your own book?</b></p>
HTML Code:
p.hasImage {
  float: left;
}

a.hasImage { border: 0 none }
a:link.hasImage { border: 0 none }
a:visited.hasImage { border: 0 none }
a:active.hasImage { border: 0 none }
a img { border: none }
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Decaf is offline
Reply With Quote
View Public Profile Visit Decaf's homepage!
 
Old 12-28-2008, 06:15 PM Re: float:left; won't work
Novice Talker

Posts: 5
Trades: 0
Nope, same problem. Maybe there's something else wrong with my CSS?
lukeprog is offline
Reply With Quote
View Public Profile
 
Old 12-28-2008, 07:41 PM Re: float:left; won't work
Defies a Status

Posts: 1,605
Trades: 0
Try creating a class to float your images that is seperate from the .p classes and I think you may find success.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 12-28-2008, 09:44 PM Re: float:left; won't work
Novice Talker

Posts: 5
Trades: 0
Nope, still doesn't work.
lukeprog is offline
Reply With Quote
View Public Profile
 
Old 12-29-2008, 08:41 AM Re: float:left; won't work
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
The pseudo class MUST be after the class name declaration

a.className:pseudoClass
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-29-2008, 09:34 AM Re: float:left; won't work
Defies a Status

Posts: 1,605
Trades: 0
Quote:
Originally Posted by lukeprog View Post
Nope, still doesn't work.
It may not be the 100% correct way to do it

and

It may not have worked as you tried to do it but don't tell me it doesn't work.

Here is an image to show you that it does.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 12-29-2008, 02:19 PM Re: float:left; won't work
Novice Talker

Posts: 5
Trades: 0
Quote:
Originally Posted by colbyt View Post
It may not have worked as you tried to do it but don't tell me it doesn't work.
No, of course I know it works, I just can't figure out why it isn't working when I try it. I must be doing something wrong, I just can't figure out what.

Quote:
Originally Posted by chrishirst
The pseudo class MUST be after the class name declaration
Okay, thanks, fixed all those.

I dunno: I copy/paste the "relevant" code over here and it works, but it won't work if I copy/paste ALL my code. So there must be something in my CSS that is messing things up that I don't think is relevant but is affecting things.

It doesn't work even if I make the entire img object do float:left;

It also doesn't help if I preface the img and p objects with #content (since that's the div they appear in on the page).

Both HTML and CSS now validate for that page.

Harumph.

Last edited by lukeprog; 12-29-2008 at 02:33 PM..
lukeprog is offline
Reply With Quote
View Public Profile
 
Old 12-29-2008, 02:48 PM Re: float:left; won't work
Novice Talker

Posts: 5
Trades: 0
Sweet, I was editing the wrong CSS file. I rule.

Thanks for your help.
lukeprog is offline
Reply With Quote
View Public Profile
 
Old 12-29-2008, 02:55 PM Re: float:left; won't work
Defies a Status

Posts: 1,605
Trades: 0
Just wait more than like you can have just as much fun with missing semicolons in php files. I know I have.

Now when I get the message I just d*** semicolon.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 12-29-2008, 03:14 PM Re: float:left; won't work
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by lukeprog View Post
Sweet, I was editing the wrong CSS file. I rule.

Thanks for your help.
What's even more amusing is editing files on a live site while refreshing the development site in a browser.
or
Deleting entries on a development site DB, then realising it's actually using the live site database, because some fool didn't edit the config file after uploading.

Oh, how I laughed that day!!
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to float:left; won't work
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.32089 seconds with 12 queries