I found this Stack Overflow post, it might be the css “content” property. I have never used it myself. For images, I usually use the “background” to add an image.
The code is supposed to change the image depending on browser size. It works as expected in Chrome. The other browsers, it doesn’t work at all. It leaves the default image in place.
@jbull328 I am not against using the image as a background, the css code seems simpler for that. The problem is that I want to the box it is in to have the image fill it, no more no less and I can’t figure out how to do that with it as a background. If I specify a height and width for the div, then it won’t be responsive.
For div’s containing images, I will usually use a min-height and min-width property. Then there are some background-image properties and other things you can try to get it the way you want it. Here is an MDN doc about background css properties.
Well difference is that if you set background image of a element is that image will be seen only if you have some content that doesn’t obscure it(background image) and that content, text for example, is enough to spread element to show background image … Unless you put dimensions in pixels for said element, in this case you don’t need a content in it, to show background image. Also try to clean cache from browsers and update them.
No, that is the mobile fall back. It isn’t cut off. That is the default image that Firefox is not replacing. In Chrome, when you have the window small, that is the image that us supposed to be shown up to 399 px, then it should switch. It is working fine in Chrome.
OK, that works in the respect that it allows the images to be changed. The changed images are fixed in size and aren’t contained and scaled inside their container though. That is what I was trying to do and that I had working in Chrome. Here is my page with the ::before tag and the style applied to the div instead of the image.
I want the changing image to either scale with the page, or be able to place a wider image that is centered and is cut off on the right and left of the containing div.
header-logo is inside header. It inherits from header. You have no width or height on header. So header-logo can’t inherit any constraints. So when you define header-logo it assumes it has more room than it does. You need to define position, width and height on header to give layout to the box, so header-logo then bases it’s constraints off header.