Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Junior Member noface0711's Avatar
    Join Date
    Apr 2016
    Posts
    1
    Member #
    53839

    Background Size CSS and Browser Compatibility

    Hi Everyone,
    I have a website with a background image. I want this background image to shrink/enlarge horizontally only according to the browser's size.

    Here is the CSS I have:
    Code:
    background-image:url("/images/bgwave.jpg");
            background-repeat: no-repeat;
            background-size: 100%;
            -o-background-size:100%; /* Opera */
            -webkit-background-size:100%; /* Safari */
            -khtml-background-size:100%; /* Konqueror */
    This code works in Firefox, Opera and Safari, but in Chrome it is enlarging it vertically too. Is there a special CSS I have to use to get it to appear right in Chrome? According to w3schools.com Chrome supports background-size.

    Thanks in advance.

  2.  

  3. #2
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    The property you're looking for is still background size, but you're going to want to use the value cover, like so:
    Code:
    background-size: cover;
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:26 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com