Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
881 views
in Technique[技术] by (71.8m points)

javascript - Bootstrap - Scaling Images in a Specific Way

I have tried searching as much as I can through google as well as figuring out the issue myself, but no matter what I try(albeit my knowledge is very limited) I cannot figure out how to scale my image with bootstrap.

Basically I have two flex boxes next to each other, one I want to display the image and the other displays a checklist of items. Each column takes up 6 spots so they are even. The issue is I cannot seem to scale my image down, it is a zoomed in version of my background image that I have added.

This is my code:

<!--about section-->
<section id="about" class="bg-info">
  <div class="container-fluid">
    <div class="row">
      <!--about img col-->
      <div class="col-md-6 about-picture height-80"></div>
      <!--about text col-->
      <div class="col-md-6 about-text height-80 px-5 d-flex align-items-center justify-content-center">

This is what I am using in my css file for the image itself

.about-picture{
    background: url(../VScode/images/background.jpg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

Any help with this is greatly appreciated! Thank you!!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

background-size: cover; will "resize the background image to cover the entire container, even if it has to stretch the image or cut a little bit off one of the edges".

You might want to choose a different background-size (and background-repeat). See: MDN: background-size


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...