css only to specific images

Discussion in 'CSS' started by amitdar, Dec 24, 2009.

  1. #1
    Hi,
    I want to create a specific style to images in my website that have width and height = 30. Can i do that throw css command, or my only option is to add a class to each one (no a good option) ?
     
    amitdar, Dec 24, 2009 IP
  2. Freditpl

    Freditpl Peon

    Messages:
    28
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    img.30
    {
    width:30px;
    height:30px;
    }

    now you can added class 30 for all image where do you want to set width and height 30
     
    Freditpl, Dec 24, 2009 IP
  3. amitdar

    amitdar Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I want to create a css command that will do specific style to the images with width, height = 30, and not create a class and insert it to all of my images.

    The way you suggested is manual, and that means that i have to add the class by myself. I want a automatic thing.
     
    amitdar, Dec 24, 2009 IP
  4. vinpkl

    vinpkl Active Member

    Messages:
    899
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    58
    #4
    automatic things can be done by using server side script or by javascript. not posible with css to do things automatically.

    you can apply styles automatically in connection to .classes applied to your html elements.

    <img src="" class="im">

    if all your images with specific width have class name "im" applied to them then you can easily amend you class and apply the style to all of them.

    vineet

     
    vinpkl, Dec 24, 2009 IP