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 6 of 6
  1. #1
    Regular Coder stevenmw's Avatar
    Join Date
    Jun 2007
    Location
    OK
    Posts
    497
    Thanks
    27
    Thanked 31 Times in 31 Posts

    Background-Position Left

    Hello. I'll start with what I am trying to do.

    I want to use the CSS background-position to place text to the RIGHT of an image.

    I've got my CSS successfully moving the image to the right of my text but I want the exact opposite. I want the image on the left and the text on the right. Below is my CSS code that moves the image to the right.

    Code:
    .header {
    background-image: url(head.png);
    background-position: 50px;
    background-repeat: no-repeat;
    color: #FFFFFF;
    font-family: verdana;
    padding: 3px;
    vertical-align: middle;
    margin-left: 15px;
    }
    Again, how can i ahcieve the exact opposite? Thanks.

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello stevenmw,
    I'm not sure why you would want to use a background image to wrap text around...that would normally be don't with a float.

    Still, it could be done with margins on the text...

    Maybe you should have a look at a good float tutorial first?
    http://css.maxdesign.com.au/floatutorial/
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #3
    Regular Coder stevenmw's Avatar
    Join Date
    Jun 2007
    Location
    OK
    Posts
    497
    Thanks
    27
    Thanked 31 Times in 31 Posts
    I want it all done within a single div. I don't want to use html image code at all. I want one div with text and the image.


    There's two obvious ways to achieve what I want.

    1. use the html image code along with a div
    2. use two divs and float the div containing the image the the left.

    With option 1 i'd have to use html image codes.. With the second I'd have to use two divs.

    My purpose is to use only one div. This way all I have to do is call a single div and place text inside of it when ever I want to repeat style.
    Last edited by stevenmw; 02-18-2012 at 04:00 AM.

  • #4
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,306
    Thanks
    29
    Thanked 277 Times in 271 Posts
    Quote Originally Posted by stevenmw View Post
    I want the image on the left and the text on the right.
    Align the background image to the left using the background-position property, and use the padding-left or text-indent properties to move the text to the right and away from the background image.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • Users who have thanked Arbitrator for this post:

    stevenmw (02-18-2012)

  • #5
    Regular Coder stevenmw's Avatar
    Join Date
    Jun 2007
    Location
    OK
    Posts
    497
    Thanks
    27
    Thanked 31 Times in 31 Posts
    Thanks, Arbitrator!

  • #6
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    use firebug firefox addon . you can change css live and see the changes , use it !!!
    Last edited by VIPStephan; 02-21-2012 at 07:56 PM. Reason: signature rule violation


  •  

    Posting Permissions

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