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 4 of 4
  1. #1
    New Coder
    Join Date
    Aug 2011
    Posts
    60
    Thanks
    32
    Thanked 0 Times in 0 Posts

    Floating an inline element

    OK, I know when you float a block element, that it is taken out of the flow of the page and everything flows around it.

    Does the same happen with an inline element, however it is only taken out of the flow of the block element and all the other inline elements flow around it?

    E.g. Say I have a paragraph with multiple images, text, q tags etc etc.

    Lets say I want to float some of the text with a <span> tag or the <q> tag, I assume this would come up to float either top right or top left, and everything else would look to float around it? E.g. Text would re-size automatically? Or as the elements are inline would they lap over each other not paying attention to each other and I would need to play around with margins etc?

    I know with floating block elements there are no problems as the inline elements inside the other block elements you have floated next to, respect the other block elements..

  • #2
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    once you float something, it is not really block or inline. It's a separate class on its own. At least that's what I think, you should try testing it in a new text document, when you do these little testings you gain a lot of understanding. make sure you look at them with inspect element to gain a better picture
    Last edited by Sammy12; 08-13-2011 at 09:21 PM.

  • #3
    Regular Coder
    Join Date
    Jul 2011
    Location
    India
    Posts
    496
    Thanks
    3
    Thanked 57 Times in 56 Posts
    <span>, <q>, <a>, ... all are inline elements by default.. so no need to define float property for them.....

    Float property is required for block-level elements,


    Float will work only it size of that block-level element is smaller than its parent element.

  • #4
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    <span> still allows for white-space, therefore yes, you do float them


  •  

    Posting Permissions

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