How to make a background image clip on the left instead of the right when resizing


Max Koretskyi

Whenever I resize the window, the background image is cropped on the right, while the left dimensions of the image remain the same. Is there any way to reverse this and make a background image clip on the left?

header {
  width: 100%;
  height: 300px;
  background: url(http://www.miis.edu/system/files/media/sailboats_0.jpg);
}
<header></header>

I have a Plunkr demo here .

hash pen

This may or may not suit your needs, but you can give the element one to place a background image on the right/top of the box.background-positionright 0

example here

header {
  width: 100%;
  height: 300px;
  background: url(http://www.miis.edu/system/files/media/sailboats_0.jpg);
  background-position: right 0;
}

However, this doesn't work with SVG. If you apply this CSS to an SVG image, you need to use it on the SVG element in the markup.

Related


Clip image left and right

username Reference: Custom Thumbnails or Splash Screens for Embedded YouTube Videos Also refer to: http://lovesongforever.com ; note what happens to the size of the thumbnails generated by Youtube when the window is resized : (a) Same height (b) Left and right

Clip image left and right

username Reference: Custom Thumbnails or Splash Screens for Embedded YouTube Videos Also refer to: http://lovesongforever.com ; note what happens to the size of the thumbnails generated by Youtube when the window is resized : (a) Same height (b) Left and right

How to make this slide left to right instead of

Jessica baby: Could someone show how this slide can go left to right instead of top to bottom? var current = 0, slides = document.querySelectorAll(".randtext"); setInterval(function() { for (var i = 0; i < slides.length; i++) { slides[i].style.opacity

How to make this slide left to right instead of

Jessica baby: Could someone show how this slide can go left to right instead of top to bottom? var current = 0, slides = document.querySelectorAll(".randtext"); setInterval(function() { for (var i = 0; i < slides.length; i++) { slides[i].style.opacity

How to make this slide left to right instead of

Jessica baby: Could someone show how this slide can go left to right instead of top to bottom? var current = 0, slides = document.querySelectorAll(".randtext"); setInterval(function() { for (var i = 0; i < slides.length; i++) { slides[i].style.opacity

How to make this slide left to right instead of

Jessica baby: Could someone show how this slide can go left to right instead of top to bottom? var current = 0, slides = document.querySelectorAll(".randtext"); setInterval(function() { for (var i = 0; i < slides.length; i++) { slides[i].style.opacity

How to make the image smooth when resizing the window?

Haitian How to make the image smooth when resizing the window? I have HTML code like this: <div class="box"> <img src="http://demo.smooththemes.com/magazon/wp-content/uploads/2013/01/984632486_9d8ff89b63_b-642x336.jpg" /> </div> and CSS: .box {width:150px; h

How to make the image smooth when resizing the window?

Haitian How to make the image smooth when resizing the window? I have HTML code like this: <div class="box"> <img src="http://demo.smooththemes.com/magazon/wp-content/uploads/2013/01/984632486_9d8ff89b63_b-642x336.jpg" /> </div> and CSS: .box {width:150px; h

Background image disappears when resizing

Sean Taylor This might be a simple one, but I can't work out - can anyone tell me why my background image is disappearing below 860px here? http://staging.seedcreativeacademy.co.uk/qualifications/ I've checked all the responsive media queries I'm using, but I

CSS - Flexbox clips left and right when resizing

Dark Champion .d1 { background-color: lightblue; display: flex; justify-content: space-evenly; padding: 20px; width: 150px; } .d1 div { background-color: yellow; flex: 1; font-size: 20px; margin: 5px; } <div class="d1"> <div>There are many

CSS - Flexbox clips left and right when resizing

Dark Champion .d1 { background-color: lightblue; display: flex; justify-content: space-evenly; padding: 20px; width: 150px; } .d1 div { background-color: yellow; flex: 1; font-size: 20px; margin: 5px; } <div class="d1"> <div>There are many

CSS - Flexbox clips left and right when resizing

Dark Champion .d1 { background-color: lightblue; display: flex; justify-content: space-evenly; padding: 20px; width: 150px; } .d1 div { background-color: yellow; flex: 1; font-size: 20px; margin: 5px; } <div class="d1"> <div>There are many

CSS - Flexbox clips left and right when resizing

Dark Champion .d1 { background-color: lightblue; display: flex; justify-content: space-evenly; padding: 20px; width: 150px; } .d1 div { background-color: yellow; flex: 1; font-size: 20px; margin: 5px; } <div class="d1"> <div>There are many

CSS - Flexbox clips left and right when resizing

Dark Champion .d1 { background-color: lightblue; display: flex; justify-content: space-evenly; padding: 20px; width: 150px; } .d1 div { background-color: yellow; flex: 1; font-size: 20px; margin: 5px; } <div class="d1"> <div>There are many

CSS - Flexbox clips left and right when resizing

Dark Champion .d1 { background-color: lightblue; display: flex; justify-content: space-evenly; padding: 20px; width: 150px; } .d1 div { background-color: yellow; flex: 1; font-size: 20px; margin: 5px; } <div class="d1"> <div>There are many

CSS - Flexbox clips left and right when resizing

Dark Champion .d1 { background-color: lightblue; display: flex; justify-content: space-evenly; padding: 20px; width: 150px; } .d1 div { background-color: yellow; flex: 1; font-size: 20px; margin: 5px; } <div class="d1"> <div>There are many

How would I make the cards go left to right instead of vertical?

Helger As the title says, I want to make the cards go left to right instead of vertical, I really don't know what to do, I've tried everything including float left The code below is a card. They are all the same but the text is different, here is a screenshot

How would I make the cards go left to right instead of vertical?

Helger As the title says, I want to make the cards go left to right instead of vertical, I really don't know what to do, I've tried everything including float left The code below is a card. They are all the same but the text is different, here is a screenshot

How to make submenu items open left instead of right?

Shaqpad I am changing some parts of a WP site to RTL. Everything works fine except for the submenu items. When the cursor is over a menu item, obviously some submenu items are opened. Now my question is its open direction. In other words, I need to open the su