CSS question

Discussion in 'Web Design and Development' started by nomade, May 25, 2010.

  1. nomade macrumors member

    nomade

    Joined:
    Dec 2, 2006
    #1
    I use tiny MCE to allow user to add formatting and photo to their text.

    When I present the texte I use css to format the text.
    Code:
    .texte { color: #022b55; font-size: 14px; border-right: 10px; font-family: Helvetica, Geneva, Arial, SunSans-Regular, sans-serif; line-height: 18px; text-align: justify; margin: 15px; }
    I would like to apply a right margin to the image inside the text.

    You can see the result here : http://annemariejobin.net/fr/creativite.php?texte=6

    I'm stuck on this one, any suggestion will be welcome.:confused:

    Nomade
     
  2. jaikob macrumors 6502

    jaikob

    Joined:
    Jul 1, 2008
    Location:
    Freeland, MI
  3. nomade thread starter macrumors member

    nomade

    Joined:
    Dec 2, 2006
    #3
    Thanks jaikob,

    That would be fine if I can apply a class to the image itself. But if a apply margin-right: 5px to the class that will apply to the text as well.

    What I would like to do is to apply a right-margin only to the image.

    Nomade
     
  4. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #4
    Reread the CSS, it will only be applied to the img tag that exists inside tags with the class of texte.
     
  5. nomade thread starter macrumors member

    nomade

    Joined:
    Dec 2, 2006
    #5
    Sorry to both of you, I didn't understood that I have to create a new class.
    Now it work perfectly.

    Thanks a lot.:D
     
  6. Mal macrumors 603

    Mal

    Joined:
    Jan 6, 2002
    Location:
    Orlando
    #6
    Umm, no, I'm glad it's working, but that's not what they were saying. .texte (the class you already have) is the parent of the img you're trying to put the margin. So, you can use the parent/child selector method:

    parent child { style }

    Thus:

    .teste img { margin-right: 5px }

    tells the browser to look for img tags inside of the .teste class and apply a right margin of 5px to it.

    No new class needed.

    jW
     

Share This Page