Having trouble with Bootstrap column order with media queries - css

I am building a template for a site and it needs 4 columns. In desktop mode, or anything above tablet width, it should display all 4 columns though the outer 2 are only for padding. When in mobile mode, the outer 2 are set to disappear, but I need the middle two to reverse their order. I tried setting the 'col-' setting to reverse when under 480px, but it isn't working. I'd appreciate someone looking over my work.
HTML
<div id="inus1" class="fk-row row">
<div data-text="text" align="center" id="inyb3" class="fk-col order-1">
</div>
<div align="center" id="i80rh" class="fk-col order-2 order-xs-2">
<div id="ifo6l">
<div id="iq1zf" class="fk-headline">Thank you for your purchase!
</div>
<div data-text="text" id="ihleo">Order {{orderId}}
<div draggable="true" id="i6myy-2-2">
<div draggable="true" id="ii502-2-2-2">
<b data-text="text">
<span data-text="text" id="ix3j4">Thank you {{firstName}} {{lastName}}!</span>
</b>
</div>
</div>
</div>
</div>
<iframe frameborder="0" type="map" name="map" address="" zoom="1" maptype="q" id="in2gu" src="https://maps.google.com/maps?&z=1&t=q&output=embed"></iframe>
</div>
<div align="center" id="i33dp" class="fk-col order-3 order-xs-1">
<table id="orderSummaryTable" class="w-100">
<thead id="iweztk">
<tr id="ikyi1h">
<th colspan="3" id="i10uii">
<span data-text="text" id="iqvl9r">Order Summary</span>
</th>
</tr>
<tr id="ieggiv">
<th id="inwrj">
<span data-text="text" id="ipokfh">Item</span>
</th>
<th id="i259c">
<span data-text="text" id="i5gfso">Quantity</span>
</th>
</tr>
</thead>
<tbody id="items-list">
<tr>
<td class="cell cell-items-list">
</td>
</tr>
</tbody>
</table>
</div>
<div align="center" id="ijiyf" class="fk-col order-4">
</div>
</div>
CSS (just the media query)
#media (max-width: 480px){
#in2gu{
width:615px;
height:350px;
}
#i80rh{
width:100%;
}
#i33dp{
width:100%;
}
#inyb3{
display:none;
}
#ijiyf{
display:none;
}
#in2gu{
width:615px;
height:350px;
}
}

Bootstrap comes with ordering utilities. Try them by appending order-0, order1, etc. to your elements
https://getbootstrap.com/docs/4.0/utilities/flex/#order

Related

descendant selector not working for .v-data-table th {*some style*}

I have a v-data-table with table headers and the styling is inside the .vue component. When I use the following style
.v-data-table-header th {
white-space: nowrap;
}
Nothing happens to the table headers. I have also tried other css like background and text colors and nothing is happening. I checked the dev tools and there are definitely th elements and it doesn't seem like the style is being overridden by anything since it's not even showing up in the styles tab of the dev tools. If i just use .v-data-table-header the style is applied. What could be going on here?
edit:
here is the vue code
<v-expansion-panel>
<v-expansion-panel-header>
Example header
</v-expansion-panel-header>
<v-expansion-panel-content>
<v-data-table
:headers="someHeaders"
:items="someItems"
/>
</v-expansion-panel-content>
</v-expansion-panel>
Here is the html for the table:
<div class="v-expansion-panel-content__wrap">
<div data-v-7037ec41="" class="v-data-table v-data-table--has-bottom theme--light">
<div class="v-data-table__wrapper">
<table>
<colgroup>
<col class="">
<col class="">
<col class="">
</colgroup>
<thead class="v-data-table-header">
<tr>
<th role="columnheader" scope="col" aria-label="Name: Not sorted. Activate to sort ascending."
aria-sort="none" class="text-start sortable"><span>Name</span><i aria-hidden="true"
class="v-icon notranslate v-data-table-header__icon material-icons theme--light"
style="font-size: 18px;">arrow_upward</i></th>
<th role="columnheader" scope="col" aria-label="Path: Not sorted. Activate to sort ascending."
aria-sort="none" class="text-start sortable"><span>Path</span><i aria-hidden="true"
class="v-icon notranslate v-data-table-header__icon material-icons theme--light"
style="font-size: 18px;">arrow_upward</i></th>
<th role="columnheader" scope="col"
aria-label="Message: Not sorted. Activate to sort ascending." aria-sort="none"
class="text-start sortable"><span>Message</span><i aria-hidden="true"
class="v-icon notranslate v-data-table-header__icon material-icons theme--light"
style="font-size: 18px;">arrow_upward</i></th>
</tr>
</thead>
<tbody>
<tr class="">
<td class="text-start">r3_ibmmq_jms_0.1</td>
<td class="text-start">Routes/MICROSERVICE</td>
<td class="text-start">cMQConnectionFactory component
"cMQConnectionFactory_1":MQTT_RECONNECT_DELAY of cMQConnectionFactory was changed to 10</td>
</tr>
<tr class="">
<td class="text-start">r4_ibmq_jms_job_0.1</td>
<td class="text-start">Routes/MICROSERVICE</td>
<td class="text-start">cMQConnectionFactory component
"cMQConnectionFactory_1":MQTT_RECONNECT_DELAY of cMQConnectionFactory was changed to 10</td>
</tr>
</tbody>
</table>
</div>
<div class="v-data-footer">
<div class="v-data-footer__select">Rows per page:<div
class="v-input v-input--hide-details v-input--is-label-active v-input--is-dirty theme--light v-text-field v-text-field--is-booted v-select">
<div class="v-input__control">
<div role="button" aria-haspopup="listbox" aria-expanded="false" aria-owns="list-101"
class="v-input__slot">
<div class="v-select__slot">
<div class="v-select__selections">
<div class="v-select__selection v-select__selection--comma">10</div><input
aria-label="Rows per page:" id="input-101" readonly="readonly" type="text"
aria-readonly="false" autocomplete="off">
</div>
<div class="v-input__append-inner">
<div class="v-input__icon v-input__icon--append"><i aria-hidden="true"
class="v-icon notranslate material-icons theme--light">arrow_drop_down</i>
</div>
</div><input type="hidden" value="10">
</div>
<div class="v-menu">
<!---->
</div>
</div>
</div>
</div>
</div>
<div class="v-data-footer__pagination">1-2 of 2</div>
<div class="v-data-footer__icons-before"><button type="button" disabled="disabled"
class="v-btn v-btn--disabled v-btn--icon v-btn--round v-btn--text theme--light v-size--default"
aria-label="Previous page"><span class="v-btn__content"><i aria-hidden="true"
class="v-icon notranslate material-icons theme--light">chevron_left</i></span></button>
</div>
<div class="v-data-footer__icons-after"><button type="button" disabled="disabled"
class="v-btn v-btn--disabled v-btn--icon v-btn--round v-btn--text theme--light v-size--default"
aria-label="Next page"><span class="v-btn__content"><i aria-hidden="true"
class="v-icon notranslate material-icons theme--light">chevron_right</i></span></button>
</div>
</div>
</div>
</div>
I figured out the issue. The vue component was using 'scoped' styles which stops styling from applying to child components. I removed the scoped from <style scoped> and now it works as expected.

Responsive drop-down menu with table inside

Hi I'm trying to obtain responsive menu on navbar in application on which I work with bootstrap 3. My menu has element with bell icon. The purpose of this one is to remind user some information. Below I show that menu element on screen:
I have fixed settings for width of my menu. I'd like to have responsive menu, not static, because this application should work on few screen resolutions. What should I obtain that? I tried to obtain that by pecrentage property for: width, min-with properties, but it has crashed.
Below I show html tags and CSS settings:
Html:
<li class="dropdown ng-isolate-scope open" loader="remainderLoading"><a ng-show="!loader" id="reminderLink" class="dropdown-toggle" data-toggle="dropdown" style="font-size:18px; cursor:pointer;" ng-click="removeNotification()" aria-expanded="true"><i class="fa fa-bell"></i></a>
<!-- ngIf: numOfRemindedNotes && !loader && !clicked -->
<div id="reminderMenu" class="dropdown-menu">
<div class="form-group col-md-7 disabled">
<label>Reminder's date:</label>
<input type="text" class="form-control ng-pristine ng-untouched ng-valid ng-isolate-scope ng-not-empty ng-valid-date ng-valid-required" ng-change="getNotesByDate()" initdate="new Date()" ng-click="noteDatepicker.opened = true" uib-datepicker-popup="" ng-model="dateNotes.value" is-open="noteDatepicker.opened" ng-required="true" close-text="Close" readonly="" required="required"><div uib-datepicker-popup-wrap="" ng-model="date" ng-change="dateSelection(date)" template-url="uib/template/datepickerPopup/popup.html" class="ng-pristine ng-untouched ng-valid ng-scope ng-not-empty"><!-- ngIf: isOpen -->
</div>
</div>
<div ng-show="noteLoading" class="ng-hide">
<img width="32" height="32" src="/packages/img/loader.gif">
</div>
<div class="col-md-12">
<table id="reminderTable" class="table table-bordered table-striped" ng-show="!noteLoading">
<tbody>
<tr id="reminderTableElement">
<td class="col-md-3">
Case Id
</td>
<td class="col-md-3">
Trans id
</td>
<td class="col-md-3">
Type customer
</td>
<th class="col-md-3">
Note
</th>
<td class="col-md-3">
Date
</td>
<td class="col-md-3"></td>
</tr>
<!-- ngRepeat: note in notes.notesForBasicCustomer --><tr ng-repeat="note in notes.notesForBasicCustomer" id="reminderTableElement" class="ng-scope">
<td style="cursor: pointer;">
<a target="_self" ng-click="editCaseById(note.case_id)" class="ng-binding">426024</a>
</td>
<td class="ng-binding">
639252-2
</td>
<td>Basic</td>
<td class="ng-binding">
asdsadsa
</td>
<td class="ng-binding">
2018-08-09
</td>
<td>
<div class="btn btn-primary" ng-disabled="noteLoading" ng-click="hideReminder(note['0'].id,'basic')">Close
</div>
</td>
</tr><!-- end ngRepeat: note in notes.notesForBasicCustomer --><tr ng-repeat="note in notes.notesForBasicCustomer" id="reminderTableElement" class="ng-scope">
<td style="cursor: pointer;">
<a target="_self" ng-click="editCaseById(note.case_id)" class="ng-binding">426011</a>
</td>
<td class="ng-binding">
639252-2
</td>
<td>Basic</td>
<td class="ng-binding">
asdsa
</td>
<td class="ng-binding">
2018-08-09
</td>
<td>
<div class="btn btn-primary" ng-disabled="noteLoading" ng-click="hideReminder(note['0'].id,'basic')">Close
</div>
</td>
</tr><!-- end ngRepeat: note in notes.notesForBasicCustomer -->
<!-- ngRepeat: note in notes.notesForAdditionalCustomers -->
</tbody>
</table>
</div>
</div>
</li>
CSS:
#reminderTableElement{
font-size: 12px;
}
#reminderMenu{
min-width: 540px;
}
I would be grateful for help. Best regards ;)
You should use #media tags to implement styles. For example
#media (min-width: 1600px) {
#reminder-menu {
...
}
}
It is considered best practice to design for mobile first, so you would use min-width: 540px or whatever your smallest breakpoint is first, then add more breakpoints as needed.

Bootstrap rows and columns not working properly inside for each loop

I tried to use bootstrap row and columns classes inside a for each loop and some extra spaces are displayed as unexpected.
First I used the following code and it worked well.
<table border="0" id="myTable" class="table" >
<thead border-bottom="0">
<tr>
<th border-bottom="0" style="display: none;">Gem</th>
<th border-bottom="0" style="display: none;">Name</th>
</tr>
</thead>
<tbody>
#foreach(App\GemStone::where('active',TRUE)->orderBy('created_at', 'desc')->get() as $gemStone)
<div class="row">
<tr>
<td style="display: none;" >{{$gemStone->created_at}}</td>
<td>
<div class="col-sm-3">
<div align="center">
<img alt="Gem Stone Pic" src="{{route('get_image',['id' => $gemStone->id])}} " class="img-circle img-responsive">
</div>
</div>
<div class="col-sm-3">
<h3><b>{{$gemStone->type->type}}</b></h3>
#if($gemStone->shop->user->id == Auth::user()->id)
[Edit]<br>
#endif
{{$gemStone->size->size}}<br>
LKR: {{$gemStone->price}}<br>
<div>
{{$gemStone->description}}<br>
{{$gemStone->created_at}}
</div>
</div>
<div class="col-sm-3"> free space of 3 cols </div>
<div class="col-sm-3">free space of 3 cols </div>
</td>
</tr>
</div>
#endforeach
</tbody>
</table>
above code gave a view like this image. In order to use the free space marked in the picture, I tried adding another column by creating another <td> ... </td> inside <tr> </tr> using $counter variable as below.
<table border="0" id="myTable" class="table" >
<thead border-bottom="0">
<tr>
<th border-bottom="0" style="display: none;">Gem</th>
<th border-bottom="0" style="display: none;">Name</th>
<th border-bottom="0" style="display: none;">Name</th>
</tr>
</thead>
<tbody>
<?php $count = 0 ?>
#foreach(App\GemStone::where('active',TRUE)->orderBy('created_at', 'desc')->get() as $gemStone)
<?php $count = $count + 1 ?>
#if($count % 2)
<tr>
<div class="row">
<td style="display: none;" >{{$gemStone->created_at}}</td>
#endif
<td>
<div class="col-sm-3">
<div align="center">
<img alt="Gem Stone Pic" src="{{route('get_image',['id' => $gemStone->id])}} " class="img-circle img-responsive">
</div>
</div>
<div class="col-sm-3">
<h3><b>{{$gemStone->type->type}}</b></h3>
#if($gemStone->shop->user->id == Auth::user()->id)
[Edit]<br>
#endif
{{$gemStone->size->size}}<br>
LKR: {{$gemStone->price}}<br>
<div>
{{$gemStone->description}}<br>
{{$gemStone->created_at}}
</div>
</div>
</div>
</td>
#if(!($count % 2))
</div>
</tr>
#endif
#endforeach
#if($count%2)
<td>extra cell when odd</td>
</div>
</tr>
#endif
Result looked like this which is unexpected. I tried changing the place of <div class='row'> and <div class = 'col-s6'>in several ways, but nothing worked. And I couldn't really find a mistake in the code as well . It would be grateful if someone can point where I go wrong while using the columns and row classes.
And I'm using jquery datatables to get the table view.
Add the bootstrap classes to your table elements, instead of adding additional div elements.
<table>
<tr class="row">
<td class="col-md-4">1</td>
<td class="col-md-4">2</td>
<td class="col-md-4">3</td>
</tr>
</table>

Modal content grows but the container size stays the same

I am displaying my modal with angularjs and here is the template:
<div class="modal-lg" modal="showModal" close="cancel()">
<div class="modal-header">
<h4>Cihaz Listesi - {{deviceCount}}</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-12 table-responsive">
<table st-table="devices" st-safe-src="displayedDevices" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>IMEI-1</th>
<th>IMEI-2</th>
<th>MSISDN</th>
<th>Yeni IMEI-1</th>
<th>Yeni IMEI-2</th>
<th>Durum</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="device in devices" ng-click="selectRow(device.ItsRepairImeiListId)" st-select-row="device" st-select-mode="multi">
<td>{{device.Imei1}}</td>
<td>{{device.Imei2}}</td>
<td>{{device.Msisdn}}</td>
<td>{{device.NewImei1}}</td>
<td>{{device.NewImei2}}</td>
<td>{{device.Status.StatusDescription}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td class="text-center" st-pagination="" st-items-by-page="10" colspan="7"></td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<div class="modal-footer">
<button ng-show="selectedRows.length > 0" class="btn btn-success" ng-click="activateSelected()">Aktif Et</button>
<button class="btn btn-default" ng-click="cancel()">Kapat</button>
</div>
</div>
class="modal-lg" is supposed to make the modal larger but here is what it looks like after using it:
What should I do to make both the content the container grow together ?
Türkmüsün :D table a width 100% ata telefondayım net olarak bakamıyorum şu an sonra döneceğim sana
.tabloSinifim {
Width:100%;}
Attribute olarakta atayabilirsin.

Shifting text using CSS

Using this code:
<div class="details">
<strong>Publisher:</strong>
<span class="red"><asp:Label ID="LabelPublisher" runat="server"></asp:Label></span>
</div>
<div class="details">
<strong>Author:</strong>
<span class="red"><asp:Label ID="LabelAuthor" runat="server"></asp:Label></span>
</div>
<div class="details">
<strong>Year:</strong>
<span class="red"><asp:Label ID="LabelYear" runat="server"></asp:Label></span>
</div>
...text on browser appears like this:
Publisher: publisher1
Author: author1
Year: 2014
Now using CSS I want to shift text like this on each label:
Publisher:---Publisher1
Author:-----Author1
Year:------ 2014
You can give fixed min width to strong tag
.details strong {
display: inline-block;
min-width: 100px;
}
DEMO
You should use a table for displaying text in that way.
Here is an example: http://jsfiddle.net/h8tshvty/
<table>
<tr class="details">
<td><strong>Publisher:</strong></td>
<td class="red">Publishername</td>
</tr>
<tr class="details">
<td><strong>Author:</strong></td>
<td class="red">Author name</td>
</tr>
<tr class="details">
<td><strong>Year:</strong></td>
<td class="red">Yearnumber</td>
</tr>
</table>

Resources