Jump to content

is there any difference between css and html image calling?


maxdesignerbd

Recommended Posts

difference between css and html image calling???????? if there is any difference, then which one i should use for which purpose........thanks.

Link to comment
Share on other sites

It always helps to show code. If you means this: CSS

div {   background-image: url('pic.jpg');}

and this: HTML

<div><img src="pic.jpg"></div>

The only important difference is the layout and appearance. One is not more efficient than the other. The image needs to be requested and downloaded in both cases. After that, the browser will store the image in its cache so it does not need to be downloaded again. If there are internal differences, they are small. The only real consideration is the size of the image, and that does not change.

  • Like 1
Link to comment
Share on other sites

The CSS image will be the size of the div.
The size of image is not determine by the size of the div, the viewable area of the background image is determined by the div, the image could be larger, or smaller than the div itself, the image can be positioned to specific area, using background-position, also with CSS3 you can make a small image fill the area of the larger div.
Images defined using CSS are not right clickable
How are they not right clickable? i can right click an background image, and select view background-image, granted you have to view within another page, to select copy image and such like, but it is still right clickable.
Link to comment
Share on other sites

The size of image is not determine by the size of the div, the viewable area of the background image is determined by the div, the image could be larger, or smaller than the div itself, the image can be positioned to specific area, using background-position, also with CSS3 you can make a small image fill the area of the larger div.
The size of the image being the size of the image element. Yes, it is.
How are they not right clickable? i can right click an background image, and select view background-image, granted you have to view within another page, to select copy image and such like, but it is still right clickable.
The majority of browsers don't do that, though.
Link to comment
Share on other sites

The size of the image being the size of the image element. Yes, it is.
I don't know what you trying to point out? a image used as a background image DOES not force the div to be the size of the image used, unless you specify the size with CSS, or content within the div element makes it high enough to view the image, otherwise the div element will just collapse to zero height, meaning the image wont be viewable.
The majority of browsers don't do that, though.
Not true! its available if you know where to look.
Link to comment
Share on other sites

I don't know what you trying to point out? a image used as a background image DOES not force the div to be the size of the image used, unless you specify the size with CSS, or content within the div element makes it high enough to view the image, otherwise the div element will just collapse to zero height, meaning the image wont be viewable.
That's literally my entire point. Not sure you were trying to achieve by "correcting" me.
Not true! its available if you know where to look.
"The majority of browsers" ... "Right click". You cannot, in the majority of browsers, right click view background image.
Link to comment
Share on other sites

Err pointing out to OP, that what was implied was not correct! in that 'The CSS image will be the size of the div.' when used as a CSS background image. IT does not stretch/shrink to size of div container, unless you use css3 styling to do so. You CAN right click to gain access to background image, it might not be shown as 'view background image' but it is still accessible by the right click.

Link to comment
Share on other sites

Err pointing out to OP, that what was implied was not correct! in that 'The CSS image will be the size of the div.' when used as a CSS background image. IT does not stretch/shrink to size of div container, unless you use css3 styling to do so. You CAN right click to gain access to background image, it might not be shown as 'view background image' but it is still accessible by the right click.
I'm talking about this in the context of web design. You're not. The size of the image is the size of the visible portion of the image (whatever size it has been scaled to) on the screen measured in pixels. Not the size of the image file itself, because that would be silly.
Link to comment
Share on other sites

Yes! I get that! I never mentioned image file size, why would I, it has nothing to do with what i am talking about! THE DIV SIZE CAN ONLY BE DEFINED BY THE USER SETTING TO A FIXED HEIGHT AND WIDTH TO MATCH THAT OF THE IMAGE, THE BACKGROUND IMAGE WILL NEVER!, I REPEAT NEVER! DEFINETHE DIMENSIONS OF THE DIV CONTAINER ELEMENT ITSELF TO ACCOMMODATE THE SIZE OF THE IMAGE USED.

Link to comment
Share on other sites

Because you still don't understand that this

The CSS image will be the size of the div.
based on the given example of using background-image is wrong.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...