Text overflowing from Bootstrap 4 row - html

EDIT: As requested here is the jsfiddle
When the screen gets too small for the text to fit in the row, it just overlaps other rows, rather than extending the row height. Perhaps this is because I set row heights on every row as a percentage value, in order to lay out my html page with even spacing and vertical alignment. How do I correct this overlapping of text onto other rows? Should I be looking into somehow vertically aligning my rows without setting their height? Or can I keep it the way it is and add some kind of overflow property to each row to tell them to extend their height when necessary?
All relevant images and code:
screenshot of fullscreen (good - no problems yet)
screenshot of hovering over the middle row element on smaller screens (problems)
screenshot of hovering over the bottom row of smaller screens:
all my html for the page:
<div id="landing-page" class="text-uppercase">
<div class="row hidden-lg-up" style="height:20%;overflow-y:auto;">
<div class="col-xs-3 flex-xs-middle">
<img width="100" src="images/monster2.png" />
</div>
<div class="col-xs-3 offset-xs-6 flex-xs-middle">
<img class="pull-xs-right" width="100" src="images/monster4.png" />
</div>
</div>
<div class="row" style="height:95%;overflow-y:auto;">
<div class="col-xs-1 col-sm-2 col-md-3 hidden-md-down flex-xs-top flex-sm-middle">
<img width="80%" src="images/monster2.png" />
</div>
<div class="col-md-12 col-lg-6 flex-xs-middle ">
<div id="motto-text" style="text-align: center;">
<h5 class="text-muted display-6">the vegan repository</h5>
<h1 class="display-3">
find vegan stuff* near you.
</h1>
<a id="try-now-button" class="with-border clickable" href="#search-filter-page">
<h5 class="text-center medium-text">try now</h5>
</a>
</div>
</div>
<div class="col-xs-1 col-sm-2 col-md-3 hidden-md-down flex-xs-top flex-sm-middle">
<img class="pull-xs-right" width="80%" src="images/monster4.png" />
</div>
</div>
<div class="row" style="height:5%;overflow-y:auto;">
<h4 class="display-6 flex-xs-bottom">
*Stuff like restaurants, meat alternatives, dairy alternatives, and much more!
</h4>
</div>
</div>
all my css for the page:
div#landing-page {
background-color: #696969;
height: 100%;
padding: 110px 40px 0px 40px;
overflow-y: auto;
min-height:470px;
}
EDIT: As requested here is the jsfiddle

Alright. Now the question is clear. The problem was easy to fix.
The problem is in the following div. You have specified it to have col-md-12 but you didn't force it when the screen is xs
<div class="col-md-12 col-lg-6 flex-xs-middle ">
<div id="motto-text" style="text-align: center;">
<h5 class="text-muted display-6">the vegan repository</h5>
<h1 class="display-3">
find vegan stuff* near you.
</h1>
<a id="try-now-button" class="with-border clickable" href="#search-filter-page">
<h5 class="text-center medium-text">try now</h5>
</a>
</div>
</div>
so the simplest thing is to add col-xs-12 class to prevent overlapping
See example

Related

card box across full screen width - bootstrap

How can I adjust my 'card' so that it is displayed across the entire width of the screen?
I am using bootstrap
<div class="card">
<h4 style="margin-top: 5px; width: 100%;">{{$tipo->tipo }}</h4>
</div>
i need width similar to footer
If you are using the latest Bootstrap 4 then this code will create a card across the entire width:
<div class="card w-100 mt-2">
<h4>Restaurante</h4>
</div>
If there is still a gap then it is likely you have padding on the container div surrounding the card, so you would need to remove that.
the first thing you need to notice it's that card class display is flex in bootstrap.Also card-body has a 20px padding.So the first thing you need is use p-0 in card-body then devide your card body to multi row.So you below code:
<div class='card'>
<div class='card-img-top'>
<img src='...' />
</div>
<div class='card-body p-0'>
<div class='row mx-0'>
<div class='col-12 p-2'>
...card content
</div>
</div>
<div class='d-block px-0'>
<h4>Your footer</h4>
</div>
</div>
</div>
if you put a clear image to view what you want,I will help you more.I hope I could help you.

how to fit both text and image in a row using 2 col-md-6

<style>
.backgroundcolor1 {
background-color: #567892;
}
</style>
<section>
<div class="row" align="center">
<div class="col-md-12 backgroundcolor1">
<div class="col-md-6 col-sm-6">
<div class="col-md-10 col-lg-offset-1 ">
<br>
<img src="assets/images/SPA/Icons/facials.png" class="icons" alt=""><br>
<h3>FACIALS</h3>
<p align="justify">Have you ever treated to a facial?<br> Facial treatments feel good, offering soothing relaxation, according to Day Spas. Facial massage treatments increase circulation and the flow of blood, and they include a variety of cremes,
aromatherapy and oils that moisturize the skin, smell good, and relieve stress as well as encourage peace of mind and contentment</p>
</div>
</div>
<div class="col-md-6 col-sm-6 textbox">
<img src="assets/images/SPA/facial.jpg" style="height: 100%; width: 100%; object-fit: contain;opacity:0.9;padding:0;margin:0; " alt="">
<figcaption><br><br><br>
<h3>Facials</h3>
</figcaption>
[enter image description here][1]
</div>
</div>
</div>
</section>
I am getting proper image fitting to text.. after i start resizing my image start reducing and there will be gap like the below image. i don't want it to happen for all the devices. my entire site is in this manner only. i don't want that extra background showing at the right side of the image.can anybody help me to solve this problem.
you can create row inside col-md-6 and define column that you want like
<div class="col-md-6 col-sm-6 textbox">
<div class="row">
<div class="col-md-7 col-sm-6">
<img src="">
</div>
<div class="col-md-5 col-sm-6">
<p>Text goes here.....</p>
<p>ddescription goes here</p>
</div>
</div>
</div>
you can print text first and image in second and change col length with your need. I hope this is what you need if not please try to clarify your question.
Please check this
.backgroundcolor1 {
background-color: #567892;
}
.back_imag{position:absolute !important; background:url(http://via.placeholder.com/500x400) no-repeat; background-size:cover; background-position:center center; left:0px; top:0px; bottom:0px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/>
<section class="container">
<div class="row" align="center">
<div class="col-xs-12 backgroundcolor1">
<div class="col-xs-6 col-sm-6">
<div class="col-md-10 col-lg-offset-1 ">
<br>
<img src="assets/images/SPA/Icons/facials.png" class="icons" alt=""><br>
<h3>FACIALS</h3>
<p align="justify">Have you ever treated to a facial?<br> Facial treatments feel good, offering soothing relaxation, according to Day Spas. Facial massage treatments increase circulation and the flow of blood, and they include a variety of cremes,
aromatherapy and oils that moisturize the skin, smell good, and relieve stress as well as encourage peace of mind and contentment</p>
</div>
</div>
<div class="col-xs-6 col-sm-6 textbox back_imag col-xs-offset-6">
<img src="" class="" alt="">
<figcaption><br><br><br>
<h3>Facials</h3>
</figcaption>
[enter image description here][1]
</div>
</div>
</div>
</section>

Grid is flying around on the responsive part

I am struggling a lot with the responsive part of a page.
When I scale down to around 991 px, the book, and the headline text is flying around. Originally I used sm-hidden and sm-visible, because I would like that the text headline came first, and afterwords the picture of the book.
But how can I solve this? I am starting to run low on ideas how to make it fit, so the book is not going under the background picture when I reach around the 991 px. I would like that the headline and book img stayed inside the background picture.
I hope somebody can through the developer console see what is wrong here. My code until now looks like this:
<div class="background-image" #Html.Raw(topImageStyling)>
<div>
<div class="container">
<div class="row">
<div class="col-sm-12 col-md-12 img logo img-responsive">
<img src="https://www.site.dk/img/inovo-logo-white-small.png">
</div>
</div>
</div>
<div class="book container col-sm-12 hidden-sm hidden-xs col-md-3 col-lg-4">
<img src="https://www.site.dk/img/landingpages/.png">
</div>
<div class="container col-sm-12 col-md-9 col-lg-8">
#if (!string.IsNullOrEmpty(headerText))
{
if (pageAlias == "Blog")
{
<h1 class="header-xl center">
#Html.Raw(headerText)
</h1>
}
else
{
<p class="header-xl">
#Html.Raw(headerText)
</p>
}
}
#if (CurrentPage.HasValue("imageTeaserText"))
{
<p class="sub-header center">
#Html.Raw(CurrentPage.imageTeaserText)
</p>
}
</div>
<div class="col-sm-12 visible-sm visible-xs">
<img src="https://www.site.dk/img/landingpages/g.png">
</div>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="container-fluid">
<div class="row">
<div class="col-md-12 main-content" id="main-content">
<div class="row">
<div class="col-lg-12">
#CurrentPage.GetGridHtml("site")
</div>
</div>
</div>
</div>
</div>
</div>
</div>
So I think I might have found the solution to your problem. On line 3044 of your CSS, there is the img element. I simply added the following to your code:
img {
display: block;
max-width: 100%;
height: auto;
position: relative;
z-index: 1030;}
It works for screen sizes larger than the 960px range and acts up a little from the 760px-440px range. I figured all you have to do now is add a media query for the corresponding viewport widths. To explain the solution is simple. Within CSS all elements that are layered within the HTML document have a z-index that determines there position in the stack. From there, in order to get the z-index to respond, I set the position to relative for that img element. The z-index property only works when the position is set to something other than static which is the default value. I hope this helps! Let me know if you have any questions.

insert an element after a number of ng-repeat iteration

Is there a way to avoid such use of ng-repeat.
To fix the issue ,I used two ng-repeat using the option limitTo to display each 3 element separately.
What I want to do is ,to insert my elements and after each 3 elements ,So I add
<div class="row"> </div>
Below is my code:
<div class="row">
<div class="col-md-10 col-md-offset-1">
<div class="row l-b-margin">
<div class="col-md-4" ng-repeat="name in Courses|limitTo:3">
<div class="well well-white">
<img alt="R Programming" class="center-block l-b-margin"
height="100" ng-src="{{name.logo}}" width="100" />
<h6 style="text-align: center; color: #516979; font-size: 21px">{{name.name}}</h6>
<p class="text-space l-b-margin">Write your first code here</p>
<a class="rounded-button cta-border-button center-block m-button"
href="courses/introduction-to-r">Start Course</a>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4" ng-repeat="name in Courses|limitTo:-3">
<div class="well well-white">
<img alt="Data Manipulation" class="center-block l-b-margin"
height="100" ng-src="{{name.logo}}" width="100" />
<h6 style="text-align: center; color: #516979; font-size: 21px">{{name.name}}</h6>
<p class="text-space l-b-margin">Write your first code here</p>
<a class="rounded-button cta-border-button center-block m-button"
href="courses/data-table-data-manipulation-r-tutorial">Start
Course</a>
</div>
</div>
</div>
</div>
</div>
The simple way to do is use ($index+1)%3==0 with ng-if and put the below element at the end of ng-repeat.
<div class="row" ng-if="($index+1)%3==0"> </div>
Plunker
Hope it helps :)
What you're seem to be doing is trying to prevent this situation from happening: (some blocks shifts to the next row if not all have equal heights)
If that's the case you can (and should;) ) fix it via simple css: (just add a custom class to the div your iterating over)
.my-block:nth-child(3n+1) {
clear: left;
}

Test doesn't stack when screen is minimized bootstrap 3

Ok so I have the following HTML
<div class="container">
<div class="row col-sm-12" id="productBrief">
<div id="RaspberryAndChocolate" style="display:none; height:200px;">
<div class="col-sm-6 text-center">
<img src="~/Content/Images/YogurtImages_404x290/Rasberry_White_Chocolate_Yogurt.png" class="img-responsive" style="margin: 0 auto; padding-top: 5%" alt="Rasberry White Chocolate Yogurt" />
</div>
<div class="col-sm-6">
<h2 class="raspberryRed productLineHeight">FLAVOUR #3</h2>
<h1 class="raspberryRed">
RASPBERRY &<br /> WHITE CHOCOLATE
</h1>
<p class="productPara">
A decadent combination of whole raspberries and smooth white chocolate that you will want to make last as long as possible. Teaspoon recommended.
</p>
<p>
<span class="label label-danone label-as-badge" style="font-size: 0.9em; padding:3%">VIEW ALL FLAVOURS</span>
</p>
</div>
</div>
<div class="clearfix"></div>
<div id="BlueBerry" style="display:none; height:200px;">
<div class="col-sm-6 text-center">
<img src="~/Content/Images/YogurtImages_404x290/Blueberry_Yogurt.png" class="img-responsive" style="margin: 0 auto; padding-top: 5%" alt="Blueberry Yogurt" />
</div>
<div class="col-sm-6">
<h2 class="blueBerry productLineHeight">FLAVOUR #6</h2>
<h1 class="blueBerry">
BLUEBERRY
</h1>
<p class="productPara">
Just imagine plump and juicy blueberries immersed in a deliciously creamy yoghurt. Enough said.
</p>
<p>
<span class="label label-as-badge" style="font-size: 0.9em; padding:3%">VIEW ALL FLAVOURS</span>
</p>
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-lg-12 text-center">
<div class="col-lg-2"></div>
<p style="width:70%;" class="text-center col-lg-8">
Experiencing Ultimate's uniquely luscious texture for the first time is beyond words. So don't even try. Take a moment to enjoy the ultra creaminess, the juicy ripened fruits and an array of wicked indulgences that come together to create a yoghurt like no other.
</p>
<div class="col-lg-2"></div>
</div>
</div>
Now there are roughly about 8 different divs but for simplicity I am only showing 2, but only one div is shown look at it as a random affect so the user refreshes the page a different div is shown (this is done in jquery) but if you look at the bottom of the HTML you will see another row with a P tag this is what is causing he issue, when displayed on a desktop it shows like this
when I minimize the browser the text at the bottom of the image displays under the text located to the right hand side of the yogurt box as shown here.
I have added the clearfix, tried adding a new container and yet the problem still remains....
You are using invalid bootstrap grid. Col should be a child of row. Use correct grid and everything will work perfectly.
Scott, hunzaboy says you need to use the dive like this
<div class="row">
<div class="col-sm-12"></div>
</div>
I don't fully understand your question, but hope you asking this,
when re-sizing your first image, I will suitably re-size without any harm to other divs. For that You need to devide that into 3 main divs, check the below code
<div class="row">
<div class="col-md-6">This is the image holding div</div><div class="col-md-6"> this is the right side text "Flavour #6, etc..."</div>
<div class="col-md-12">This is the text on the bottom</div>
</div>
I will look, 2 columns on the top and one column in the bottom.
For mobile view, you can use col-xs-12class, the it will show as stack.
Hope this is you asking. Thanks