Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Having Trouble the Little float property

    I have a site that has 2 images 1 is for the main logo located at the top of the page (it is centered) and one is an image located in the middle of the page. I wanted the image located in the middle of the page to allow text to wrap around the top,right side and bottom. I used this code
    img
    {
    float:left;
    border:0px solid black;
    margin:0px 10px 15px 20px;
    }

    to accomplish the matter and it works perfect. However it makes my main logo at the top of the page position itself to the left not the center.

    Could someone please tell me why it is when I use that code it works perfect for the middle image but makes my logo at the top of the page shift to the left. Now I have the above code placed inside a <p> tag because the image sits in the middle of a long paragraph. In other words i have <p> then a whole bunch of text (in the middle of the text I have my Image) then more text and at the end of all the text is a </p>


    Thanks

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    The Netherlands, Baarn, Ut.
    Posts
    4,252
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Selector

    If you use just the img element selector for the float rule, it will apply to all images no matter where they are located, which is exactly what you experience.
    You need to use a more specific selector for your floated image; to give any pointers, a look a the markup would be nice. It probably sits inside a containing element of sorts, which can be employed to make a more specific selector.
    Regards,
    Ronald.
    ronaldvanderwijden.com


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •