Jump to next line a neested column in bootstrap3 - html

I have a problem dealing with nested columns in bootsrap 3. The thing is that I have a background image and a text floating to the right like this:
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 test">
<div class="row">
<div class="col-sm-6 col-sm-offset-6 col-md-6 col-md-offset-6 col-xs-12">
<div class="description">
<p>
TEXT DESCRIPTION
<button type="button" class="btn btn-primary">sTART</button>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
The test class is to added to have a background-image to that div.
.test {
background-repeat: no-repeat;
background-size: 100% 100%;
height: 300px;
background-image: url("../img/imgage.jpg");
}
What I want is to break to a new line when displayed on a mobile screen the nested column that contains the TEXT DESCRIPTION; more precisely this part of code:
<div class="row">
<div class="col-sm-6 col-sm-offset-6 col-md-6 col-md-offset-6 col-xs-12">
<div class="description">
<p>
TEXT DESCRIPTION
<button type="button" class="btn btn-primary">Start</button>
</p>
</div>
</div>
</div>
So the TEXT DESCRIPTION jumps below the background image in a new line.
PS: I don't want to use the same code with two different divs and control the with the responsive utilities eg: hidden-xs.
Here is a link to the Plunker for what I did so far:
Plunker code example

Related

Stop background collapsing with context

I have a div which has a background image and some text and I want the content of div to stop overlapping from a part (ribbon part) of the backgrounf image. Please check images so that it's clear to you what I am willing to do.
This is how it should appear on all screens (except phones)
This is not how I want it to be. I want the text to stay away from ribbon for all screen sizes
Html:
<div id="overview1" class="col-md-4">
<div class="row d-flex align-items-center height-33">
<div class="col-lg-4 col-md-5 d-sm-block d-none"></div>
<div class="benefits col-lg-8 col-md-7">
<h3 class="text-uppercase overview1-heading ms-3">
<span class="overview1-text">2023</span>
<span class="overview1-text">benefits</span>
overview
</h3>
</div>
</div>
</div>
css:
#overview1 {
background-image: url("ribbon.jpg");
background-position: 10% 100%;
background-size: cover;
background-repeat: no-repeat;
color: white;
}
I would do it a bit differently if I were you. Instead of setting the background-image on the #overview-1, I would make two columns (put the image inside the left column and put the text inside the right column).
It would be easier to help you if you edit your question and add more HTML & CSS. Also, having a similar image (at least) would be very helpful to test the snippet.
Something like this:
<div id="overview1" class="col-md-4">
<div class="row d-flex align-items-center height-33">
<div class="col-lg-4 col-md-5 d-sm-block d-none"></div>
<div class="benefits col-lg-8 col-md-7">
<div class="row">
<div class="col-6">
<!-- Image here -->
</div>
<div class="col-6">
<h3 class="text-uppercase overview1-heading ms-3">
<span class="overview1-text">2023</span>
<span class="overview1-text">benefits</span> overview
</h3>
</div>
</div>
</div>
</div>
</div>

Why isn't BootStrap column offset working?

I am trying to build a website with flash-cards to help learn the Hebrew alphabet. My Card partial view looks like this:
#model FlashCards.MultipleChoice.ViewModels.CardViewModel
<div class="index-card">
<div class="row">
<div class="col-md-offset-5"></div>
<div class="col-md-2 text-center">
#Model.Numeric
</div>
</div>
<div class="row">
<div class="col-md-offset-2"></div>
<div class="col-md-8 text-center card-symbol">
#Html.Raw(Model.UnicodeEscape)
</div>
</div>
<div class="row">
<div class="col-md-offset-2"></div>
<div class="col-md-8 text-center">
#Model.Name
</div>
</div>
</div>
Now the col-md-offset works on all but the first row, causing the card to render as in the below image:
Now why isn't the 1 in the image offset like the glyph and the name for the letter Aleph?
My CSS file for these cards only contains the following so far:
.index-card {
height: 150px;
}
.index-card .card-symbol {
font-size: large
}
I believe you're using the offset classes wrong; do not apply them to empty divs.
Your text is centered. Second and third rows have widths of 8 columns. It looks like the offset is working but it really isn't. The first row is only 2 columns wide. None of your offset divs are having any effect on the layout.
You need to do something like this, at the very least:
<div class="index-card">
<div class="row">
<div class="col-md-offset-5 col-md-2 text-center">
#Model.Numeric
</div>
</div>
<div class="row">
<div class="col-md-offset-2 col-md-8 text-center card-symbol">
#Html.Raw(Model.UnicodeEscape)
</div>
</div>
<div class="row">
<div class="col-md-offset-2 col-md-8 text-center">
#Model.Name
</div>
</div>
</div>

How can I center the column vertically in bootstrap mobile mode?

I am trying to center the first column in the middle vertically , for the mobile mode xs:
<div class="row toplineheight vcenteritems totalblue visible-xs">
<div class="col-xs-6 vcenteritems small">Your order</div>
<div class="col-xs-3">
<div class="col-xs-12"><span class="tiny">Upfront</span></div>
<div class="col-xs-12 dollar large middle">0</div>
</div>
This is my css(bootstrap 3):
.cart {
.verticalline {
border-left: thin solid #f7f7f7;
}
At the moment the 'your order' text stays stuck to the top of the div. How can I align this in the center?
Codepen here: codepen
using the class visible-xs on your .row element is overriding your display:flex css value. Moving the class to a containing element
CODEPEN
HTML
<div class="cart">
<div class="visible-xs"> <!-- move visible-xs class to a parent container -->
<div class="row toplineheight vcenteritems totalblue">
<div class="col-xs-6 vcenteritems small">Your order</div>
<div class="col-xs-3">
<div class="col-xs-12"><span class="tiny">Upfront</span></div>
<div class="col-xs-12 dollar large middle">0</div>
</div>
<div class="col-xs-3">
<div class="col-xs-12"><span class="tiny">Monthly</span></div>
<div class="col-xs-12 dollar large middle">0</div>
</div>
</div>
</div>
</div>

Centre align div content in bootstrap

I want my date picker to be in the middle of the page, eg. the line where I have: <div class="center-block text-center datepicker"></div>
Obviously center-block and text-center I tried already - but neither change anything. And with the offset it just makes it close to the centre without being perfectly centre aligned.
What do I need to do?
Thanks
<div class='row'>
<div class='col-sm-12'>
<div class='page-header page-header-with-icon mg-t'> <i class='fa-icon-calendar'></i>
<h2>Calendar</h2>
</div>
<div class="row">
<div class="col-sm-4 col-sm-offset-4">
<div class="center-block text-center datepicker"></div>
</div>
</div>
</div>
</div>
Try something like this:
<div class="col-sm-12">
<div class="datepicker"></div>
</div>
Then give the date picker something like:
.datepicker {
display:inline-block;
margin:0 auto;
}
I haven't tested this, but it would be where I would start.
style="text-align:center;" shall do the trick no? I tested and for me, the "CALENDAR" text is centered
<div class="col-sm-12">
<div class="page-header page-header-with-icon mg-t" style="text-align:center;">
<i class="fa-icon-calendar"></i>
<h2>Calendar</h2>
</div>
<div class="row">
<div class="col-sm-4 col-sm-offset-4">
<div class="center-block text-center datepicker"></div>
</div>
</div>
</div>
</div>
This is what should solve your problem. Add it somewhere in your custom stylesheet and change the width % to what suits your design.
.datepicker-inline {
width: 20%;
}

twitter bootstrap - minimum width column?

this has to have been asked before, but i don't think my "terms" are correct.
i have a page that has text, and then an image. When the image ends, i would like the text to flow under the image.
So,
<div class="row">
<div class="col-xs-10 col-xs-offset-1 ">
<div class="hero-unit row">
<div class="col-xs-12 ">
<h2 class="welcome">welcome</h2>
</div>
<div class="col-xs-8 ">
<p>some text here</p>
<p>imagine there is more text here</p>
<p>just, the most text ever.</p>
</div>//col-xs-8
<div class="solidClass col-xs-4 ">
<img class="img-responsive" src="/WebContent/img/both.png" alt="screenshots"/>
</div>
</div>//hero-unit-row
</div> //col-xs-10
</div>//row
in the scenario above, the text in the "col-xs-8" row should overflow when the text gets past the image in the col-xs-4 row.
is there something i can tell bootstrap by way of a class, or something i can add to a specialty class to make this happen?
The structure you would need for this layout is the next:
<div class="col-xs-12">
<div class="solidClass col-xs-4 pull-right">
<img class="img-responsive" src="http://lorempixel.com/100/100" alt="screenshots" />
</div>
<p>some text here</p>
<p>imagine there is more text here</p>
<p>just, the most text ever.</p>
</div>
Demo: http://plnkr.co/edit/vSq4rsJPbjfvdn6FYiR9?p=preview
Two important points:
Extend "left" text container to full width with .col-xs-12 class.
Move image container into text container and float it right with pull-right class.
In order for your intended effect, the image has to be in the same parent element as the text.
You can then use bootstrap's pull-right class to float the element to the right.
I, also, assume that you intended for the text to be able to fit the full 12 col width. If you want the image to still be limited to a 4 column width, you can wrap it in a bootstrap col-xs-4 class.
<div class="row">
<div class="col-xs-10 col-xs-offset-1 ">
<div class="hero-unit row">
<div class="col-xs-12 ">
<h2 class="welcome">welcome</h2>
</div>
<div class="col-xs-12">
<div class="col-xs-4 pull-right">
<img class="img-responsive" src="/WebContent/img/both.png" alt="screenshots"/>
</div>
<p>some text here</p>
<p>imagine there is more text here</p>
<p>just, the most text ever.</p>
</div>
</div>
</div>
</div>
Bootply here: http://www.bootply.com/hANj4uFgb2