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
170 views
in Technique[技术] by (71.8m points)

html - Flexbox paddings (occupy more than 100% width)

I'm working with @c4rlosls, we have 2 issues: https://imgur.com/a/PTF7ako If container-fluid father has px-0, it occupies more than 100% width. And .cont2 a and .cont3 a haven't got 100% width of their father's div.

How can I fix these 2 issues?

.inew1{
	background-image: url(../img/bg1.jpg);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    background-position: 50% 50%;
    height: 100%; 
}
.inew2{
	background-image: url(../img/bg1.jpg);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    background-position: 50% 50%;
    height: 100%; 
}
.inew3{
	background-image: url(../img/bg1.jpg);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    background-position: 50% 50%;
    height: 100%; 
}
 <div class="container-fluid px-0 "> 
      <div class="row no-gutters">
          <div class=" col-xl-8 col-lg-12 inew1 d-flex justify-content-end align-items-start flex-column">
          	

          	
          	<a href="google.uno" class="w-100">
              <h1 class="">Title</h1>
              <span>Lorem ipsum dolor sit amet</span>
            </a>
          </div>
          


        <div class="container-fluid col-xl-4 col-lg-12 ">
          <div class="row">
            <div class=" col-xl-12 inew2 d-flex justify-content-end align-items-start flex-column">
            <div class="row">
          	<a href="google.uno" class="w-100">
              <h1 class="">Title2</h1>
              <span>Lorem ipsum dolor sit amet</span>
            </a>
            </div>
            </div>
            <div class="col-xl-12 inew3 d-flex justify-content-end align-items-start flex-column">
            <div class="row">
          	<a href="google.uno">
              <h1 class="">Title3</h1>
              <span>Lorem ipsum dolor sit amet</span>
            </a>
            </div>
            </div>
          </div>
        </div>
      </div>
</div>
See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

In this you have to do below changes in your code to solve issue.

<div class="container-fluid px-0 "> 
  <div class="row no-gutters">
      <div class=" col-xl-8 col-lg-12 inew1 d-flex justify-content-end align-items-start flex-column">



        <a href="google.uno" class="w-100">
          <h1 class="">Title</h1>
          <span>Lorem ipsum dolor sit amet</span>
        </a>
      </div>



    <div class="container-fluid col-xl-4 col-lg-12 ">
      <div class="row no-gutters">
        <div class=" col-xl-12 inew2 d-flex justify-content-end align-items-start flex-column">

        <a href="google.uno" class="w-100">
          <h1 class="">Title2</h1>
          <span>Lorem ipsum dolor sit amet</span>
        </a>
        </div>

        <div class="col-xl-12 inew3 d-flex justify-content-end align-items-start flex-column">

        <a href="google.uno" class="w-100">
          <h1 class="">Title3</h1>
          <span>Lorem ipsum dolor sit amet</span>
        </a>

        </div>
      </div>
    </div>
  </div>

In above code i have added "no-gutters" in row after col-xl-4 which solve scrollbar problem... And i have remove <div class=row> from 2nd column(inew2,inew3) which solve your title background issue..


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
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

56.9k users

...