waleedd32
waleedd32

Reputation: 533

I cannot move my img element in CSS

Why can't I move a picture a little bit to the left? I can move it to the right, but not left. I have used margin and padding; neither worked. Here is the HTML:

<aside id="sidenews">
    <img src="live.jpg" alt="Mountain View">

and CSS:

#sidenews {
    float:right;
    margin: 40px 0px;
    padding:15px;
    border:1px solid yellow;
    height: 305px;
    width: 247px;
}

aside img {
    margin:0px;
    margin-right:5px;
}

Upvotes: 0

Views: 358

Answers (2)

waleedd32
waleedd32

Reputation: 533

I changed it a little bit i want to place the picture inside the yellow borders i managed to place it but you know when i press ctrl and and scroll with mouse make page smaller or bigger then the picture goes up and down why this happens here is html:

< aside id="side_news" >

< / aside >

< div id = " pic ">

     < img src= " live.jpg" alt= " Mountain View " >

 < / div >

and css:

#side_news{ 

float:right;

margin: 40px 0px; 

padding:15px; border:1px solid yellow; 

height: 305px;

width: 247px; 

} #pic{ 

clear:both; 

margin-left:730px; 

position: relative; 

bottom: 990px;

 }

Upvotes: 0

Hatora
Hatora

Reputation: 76

Change your aside img from margin: 0; and margin-right: 0; to margin: 0 5px 0 0; because your margin: 0; is rendering your margin-right unusable unless you want to add margin-right: 5 !important;

aside img {
    margin: 0 5px 0 0; /* this will work */
}

Upvotes: 1

Related Questions