Create panel with two columns - css

I am trying to create a template that has two columns in a panel. I am using plainBootstrap v3.3.7. Below you can find what I tried:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">Overview
</div>
<div class="panel-body">
</div>
<div class="container-fluid">
<div class="col-md-2">
<table class="table">
<thead>
<tr>
<th>
#
</th>
<th>
Product
</th>
<th>
Payment Taken
</th>
<th>
Status
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
1
</td>
<td>
TB - Monthly
</td>
<td>
01/04/2012
</td>
<td>
Default
</td>
</tr>
</tbody>
</table>
</div>
<div class="col-md-10">
<div class="tabbable" id="tabs-305570">
<ul class="nav nav-tabs">
<li class="active">
<a href="#panel-495769" data-toggle="tab">Section 1
</a>
</li>
<li>
<a href="#panel-207616" data-toggle="tab">Section 2
</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="panel-495769">
<p>
I'm in Section 1.
</p>
</div>
<div class="tab-pane" id="panel-207616">
<p>
Howdy, I'm in Section 2.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
However, my panel look like the following on my screen:
As you can see, in my panel the two columns inside overlap.
Any suggestions why my table and the section overlap so much?
I appreciate your replies!

Because you are wrapping a table which is by default not responsive with .col-md-2 which is a responsive class.
So you have to wrap it with .table-responsive ( a bootstrap class for making tables responsive ), check the updated snippet:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">Overview
</div>
<div class="panel-body">
</div>
<div class="container-fluid">
<div class="col-md-2">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>
#
</th>
<th>
Product
</th>
<th>
Payment Taken
</th>
<th>
Status
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
1
</td>
<td>
TB - Monthly
</td>
<td>
01/04/2012
</td>
<td>
Default
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-10">
<div class="tabbable" id="tabs-305570">
<ul class="nav nav-tabs">
<li class="active">
<a href="#panel-495769" data-toggle="tab">Section 1
</a>
</li>
<li>
<a href="#panel-207616" data-toggle="tab">Section 2
</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="panel-495769">
<p>
I'm in Section 1.
</p>
</div>
<div class="tab-pane" id="panel-207616">
<p>
Howdy, I'm in Section 2.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Hope this helps :)

The problem is your columns, wrap both the table and the section in <div class="col-md-6">In the bootstrap grid system when you define <div class="col-md-12"></div>, This is a full grid (bootstrap maximum grid) so in order to get two equal columns out of this, you just define two columns with <div class="col-md-6"></div>. Reference
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
Overview
</div>
<div class="panel-body">
</div>
<div class="container-fluid">
<div class="col-md-6">
<table class="table">
<thead>
<tr>
<th>
#
</th>
<th>
Product
</th>
<th>
Payment Taken
</th>
<th>
Status
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
1
</td>
<td>
TB - Monthly
</td>
<td>
01/04/2012
</td>
<td>
Default
</td>
</tr>
</tbody>
</table>
</div>
<div class="col-md-6">
<div class="tabbable" id="tabs-305570">
<ul class="nav nav-tabs">
<li class="active">
<a href="#panel-495769" data-toggle="tab">
Section 1
</a>
</li>
<li>
<a href="#panel-207616" data-toggle="tab">
Section 2
</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="panel-495769">
<p>
I'm in Section 1.
</p>
</div>
<div class="tab-pane" id="panel-207616">
<p>
Howdy, I'm in Section 2.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Note: Run the snippet as Full page

Related

datatable class="display nowrap" only working for active class

I have a question, I have 3 tab-pane with datatable in each one of it. I add display nowrap to it so it doesn't overflow to the right and just fill the card body. But funny enough the display nowrap only working for the first tab-pane or the default active class. Here is my code
<div class="tab-content" style="width:100%">
<div class="tab-pane fade show active col-12" id="PAKJatuhTempo1-view" role="tabpanel" aria-labelledby="home-tab">
<div>
<div id="DivPAKJatuhTempo1">
<div class="row" style="padding-top:20px;">
<div class="col-12">
<div class="main-card mb-3">
<div class="card-body border rounded">
<table id="TablePakJatuhTempoSJT" class="display nowrap" style="width:100%">
<thead style="text-align:center">
<tr>
<th>No</th>
<th>Nama Pengelola RM</th>
<th>Nama Debitur</th>
<th>Maksimum Kredit</th>
<th>Tanggal Jatuh Tempo PAK Review</th>
<th>Sebab Keterlambatan PAK</th>
<th>Langkah-Langkah Yang Telah/Akan Dilaksanakan</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade show col-12" id="PAKJatuhTempo2-view" role="tabpanel" aria-labelledby="home-tab">
<div>
<div id="DivPAKJatuhTempo2">
<div class="row" style="padding-top:20px;">
<div class="col-12">
<div class="main-card mb-3">
<div class="card-body border rounded">
<table id="TablePakJatuhTempoJTBI" class="display nowrap" style="width:100%">
<thead style="text-align:center">
<tr>
<th>No</th>
<th>Nama Pengelola RM</th>
<th>Nama Debitur</th>
<th>Maksimum Kredit</th>
<th>Tanggal Jatuh Tempo PAK Review</th>
<th>Sebab Keterlambatan PAK</th>
<th>Langkah-Langkah Yang Telah/Akan Dilaksanakan</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade show col-12" id="PAKJatuhTempo3-view" role="tabpanel" aria-labelledby="home-tab">
<div>
<div id="DivPAKJatuhTempo3">
<div class="row" style="padding-top:20px;">
<div class="col-12">
<div class="main-card mb-3">
<div class="card-body border rounded">
<table id="TablePakJatuhTempoJTBD" class="display nowrap" style="width:100%">
<thead style="text-align:center">
<tr>
<th>No</th>
<th>Nama Pengelola RM</th>
<th>Nama Debitur</th>
<th>Maksimum Kredit</th>
<th>Tanggal Jatuh Tempo PAK Review</th>
<th>Sebab Keterlambatan PAK</th>
<th>Langkah-Langkah Yang Telah/Akan Dilaksanakan</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
any solution how to make all the tab-pane display working with the display nowrap?

Bootstrap 4.1 Cards Styling

I have this code:
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="card">
<div class="card-header">Employee Information</div>
<div class="card-body">
<table class="table table-borderless">
<tbody>
<tr>
<td scope="row">First Name: </td>
<td>{{ $employee->first_name }}</td>
</tr>
<tr>
<td scope="row">Last Name: </td>
<td>{{ $employee->last_name }}</td>
</tr>
<tr>
<td scope="row">ID Number: </td>
<td>{{ $employee->id_number }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-md-8">
<div class="card">
<div class="card-header">External Training Records</div>
<div class="card-body">
External Training Records:
</div>
</div>
</div>
<div class="col-md-8 offset-md-4">
<div class="card">
<div class="card-header">Clients</div>
<div class="card-body">
Clients:
</div>
</div>
</div>
<div class="col-md-8 offset-md-4">
<div class="card">
<div class="card-header">Site</div>
<div class="card-body">
Sites
</div>
</div>
</div>
</div>
</div>
https://jsfiddle.net/aq9Laaew/206869/
I would like the two sections on the right (external training and clients) to be underneath one another (when on a desktop). How does one do that in Bootstrap?
I know very little about front-end development. This is a learning curve for me.
To achieve that using Bootstrap layout utility classes, all you need is to place all your cards into one column, instead of adding a row for each card:
<div class="row">
<div class="col-lg-4">
... your left column card here...
</div>
<div class="col-lg-8">
... rest of your cards here...
</div>
</div>
Working example:
.row {
background: #f8f9fa;
}
.col {
border: solid 1px #6c757d;
}
.card {
margin-top: 15px;
}
.card + .card:last-child {
margin-bottom: 15px;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-lg-4 col-md-5">
<div class="card">
<div class="card-header">Employee Information</div>
<div class="card-body">
<table class="table table-borderless">
<tbody>
<tr>
<td scope="row">First Name: </td>
<td>Jane</td>
</tr>
<tr>
<td scope="row">Last Name: </td>
<td>Doe</td>
</tr>
<tr>
<td scope="row">ID Number: </td>
<td>123456789123</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-lg-8 col-md-7">
<div class="card">
<div class="card-header">External Training Records</div>
<div class="card-body">
External Training Records:
</div>
</div>
<div class="card">
<div class="card-header">Clients</div>
<div class="card-body">
Clients:
</div>
</div>
<div class="card">
<div class="card-header">Site</div>
<div class="card-body">
Sites
</div>
</div>
</div>
</div>
</div>
Please note your current question title doesn't relate too well to the actual problem. You're basically asking a layout utility question. Whatever you place in your layout has no relevance for solving/answering it.
I think this is what you want
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="card">
<div class="card-header">Employee Information</div>
<div class="card-body">
<table class="table table-borderless">
<tbody>
<tr>
<td scope="row">First Name: </td>
<td>Jane</td>
</tr>
<tr>
<td scope="row">Last Name: </td>
<td>Doe</td>
</tr>
<tr>
<td scope="row">ID Number: </td>
<td>123456789123</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-md-8">
<div class="card">
<div class="card-header">External Training Records</div>
<div class="card-body">
External Training Records:
</div>
</div>
<div class="card">
<div class="card-header">Clients</div>
<div class="card-body">
Clients:
</div>
</div>
</div>
<div class="col-md-8 offset-md-4"></div>
<div class="col-md-8 offset-md-4">
<div class="card">
<div class="card-header">Site</div>
<div class="card-body">Sites</div>
</div>
</div>
</div>
</div>

Aligning texts using bootstrap grids and css with json

So heres my situtation, after I layed out the correct alignments of this emergency contact details of countries, I tried adding json to it. Unfortunately json scambled up my texts. I tried using another col grid inside "col-md-12" to no avail. I also tried bootstrap pull-right and pull-left but the hotline name and the number still does not align properly. I would like to have some advice to what can be done to position the texts.
Here is what its supposed to do: (imagine the flag is in the left side and the number are supposed to be aligned like a column)
Brunei
Ambulance: 991
Police: 993
Fire and Rescue: 995
Search and Rescue: 998
................................................................................................
Here is the current mess of text:
mess of hotlines
Thank you for the time and cooperation to anyone responding
<div class="module-text" ng-controller="VolunteerAidCtrl">
<p class="services-margin">In an emergency, please contact the appropriate service in their respective ASEAN countries for the proper response. These numbers can be called either on landline and mobile and consist of the Police Department, Fire Department, and the Hospital Ambulance. </p>
<hr>
<div class="row">
<div class="col-lg-6">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for..." ng-model="search">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Go!</button>
</span>
</div><!-- /input-group -->
</div><!-- /.col-lg-6 -->
</div>
<hr>
<div class="row">
<div class="col-md-6 services-margin" ng-repeat="service in services | filter:search">
<img class="flagsize" ng-src="{{service.flagimgurl}}">
<div class="country-title col-md-3" ng-bind="service.country"></div>
<p class="col-md-3" ng-bind="service.hl1"></p>
<span class="pull-right" ng-bind="service.hl1num1"></span>
<span class="pull-right" ng-bind="service.hl1num2"></span>
<span class="pull-right" ng-bind="service.hl1num3"></span>
<p ng-bind="service.hl2"></p>
<span class="pull-right" ng-bind="service.hl2num1"></span>
<span class="pull-right" ng-bind="service.hl2num2"></span>
<span class="pull-right" ng-bind="service.hl2num3"></span>
<p ng-bind="service.hl3"></p>
<span class="pull-right" ng-bind="service.hl3num1"></span>
<span class="pull-right" ng-bind="service.hl3num2"></span>
<span class="pull-right" ng-bind="service.hl3num3"></span>
<p ng-bind="service.hl4"></p>
<span class="pull-right" ng-bind="service.hl4num1"></span>
<span class="pull-right" ng-bind="service.hl4num2"></span>
<span class="pull-right" ng-bind="service.hl4num3"></span>
</div>
</div>
</div>
To align the image to the left and have the content on the right I would use the media object
and for proper alignment to right, why not use tables?
<div class="row">
<div class="col-md-6" ng-repeat="service in services | filter:search">
<div class="media">
<div class="media-left">
<a href="#">
<img class="media-object flagsize" src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/67/Flag_of_Brunei_1906-1959.svg/1000px-Flag_of_Brunei_1906-1959.svg.png" alt="...">
</a>
</div>
<div class="media-body">
<h4 class="media-heading country-title" ng-bind="service.country">Brunei</h4>
<table class="table">
<tr>
<td ng-bind="service.hl1">Service 1</td>
<td style="text-align:right">
<div ng-bind="service.hl1num1">111</div>
<div ng-bind="service.hl1num2">222</div>
<div ng-bind="service.hl1num3">333</div>
</td>
</tr>
<tr>
<td ng-bind="service.hl2">Service 2</td>
<td style="text-align:right">
<div ng-bind="service.hl2num1">111</div>
<div ng-bind="service.hl2num2">222</div>
<div ng-bind="service.hl2num3">333</div>
</td>
</tr>
<tr>
<td ng-bind="service.hl3">Service 3</td>
<td style="text-align:right">
<div ng-bind="service.hl3num1">111</div>
<div ng-bind="service.hl3num2">222</div>
<div ng-bind="service.hl3num3">333</div>
</td>
</tr>
<tr>
<td ng-bind="service.hl4">Service 4</td>
<td style="text-align:right">
<div ng-bind="service.hl4num1">111</div>
<div ng-bind="service.hl4num2">222</div>
<div ng-bind="service.hl4num3">333</div>
</td>
</tr>
</table>
</div>
</div>
</div>
https://jsfiddle.net/ktbmLaq8/

Dealing with cols and bootstrap grid

Currently I have col-sm-5 and col-sm-7 grid on the page which looks like this
<section class="site-content site-section">
<div class="container">
<div class="row">
<div class="col-sm-5 site-block">
<table class="table table-bordered">
<tbody>
<tr>
<td><strong>test</strong></td>
<td class="text-right">test</td>
</tr>
<tr>
<td><strong>test</strong></td>
<td class="text-right">test</td>
</tr>
<tr>
<td><strong>test:</strong></td>
<td class="text-right">test</td>
</tr>
<tr>
<td><strong>test:</strong></td>
<td class="text-right">test</td>
</tr>
</tbody>
</table>
</div>
<div class="col-sm-7 site-block">
<h3 class="site-heading">
<p><strong>test </strong></p>
</h3>
<p><hr></p>
<p><strong>test</strong></p>
<div class="row">
<div class="col-sm-4">
<h3>test1</h3>
<hr>
<p><span class="glyphicon glyphicon-file"></span> test</p>
</div>
<div class="col-sm-4">
<h3>test2</h3> <hr>
<p><span class="glyphicon glyphicon-file"></span> test</p>
</div>
<div class="col-sm-4">
<h3>test3</h3>
<hr>
<p><span class="glyphicon glyphicon-file"></span> test </p>
</div>
</div>
</div>
</div>
</div>
</section>
For better understanding what is producing this grid here is the JSFIDDLE So now I want to move both col-sm-4 on the right side of site-heading in `col-sm-7. It is not so clear what I want so here is the image of that:
Please check this and see if is what you need. I have changed the main grid to col-sm-4 and col-sm-8 then added some inside.
<section class="site-content site-section">
<div class="container">
<div class="row">
<div class="col-sm-4 site-block">
<table class="table table-bordered">
<tbody>
<tr>
<td><strong>test</strong></td>
<td class="text-right">test</td>
</tr>
<tr>
<td><strong>test</strong></td>
<td class="text-right">test</td>
</tr>
<tr>
<td><strong>test:</strong></td>
<td class="text-right">test</td>
</tr>
<tr>
<td><strong>test:</strong></td>
<td class="text-right">test</td>
</tr>
</tbody>
</table>
</div>
<div class="col-sm-8 site-block">
<div class="row">
<div class="col-sm-6">
<h3 class="site-heading">
<p><strong>test</strong></p></h3>
<p><hr></p>
<p><strong>test</strong></p>
</div>
<div class="col-sm-4">
<h3>test</h3>
<hr>
<p><span class="glyphicon glyphicon-file"></span> test</p>
<h3>test</h3> <hr>
<p><span class="glyphicon glyphicon-file"></span> test</p>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<h3>test</h3>
<hr>
<div class="row">
<div class="col-md-3">
<div class="well">6</div>
</div>
<div class="col-md-3">
<div class="well">7</div>
</div>
<div class="col-md-3">
<div class="well">8</div>
</div>
<div class="col-md-3">
<div class="well">8</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
DEMO JSFIDDLE

how to render entirely different css and html based upon the device size?

In the same page I want to load screen 1 for desktop and screen 2 for mobile devices.
screen 1 - desktop | simple bootstrap scaffolding | radio button
Here's the code for the desktop html page, and below is the code for the mobile. But I want to merge both the codes into one.
Any guidance/ direction on how to make it on same page would be great!
<body>
<div class="container">
<div class="row">
<div class="col-sm-4 col-md-4">
<h4 class="panel-title">
<input type="radio" name="sex" value="male">Elite - d<br>
</h4>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
<table class="table">
<tr>
<td>
10 Days of Cloud options
</td>
</tr>
<tr>
<td>
Up to 15 Cameras
</td>
</tr>
<tr>
<td>
Unlimited Support
</td>
</tr>
<tr>
<td>
$44 99 / Mo
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="col-sm-4 col-md-4">
<h4 class="panel-title">
<input type="radio" name="sex" value="male">Premier - d<br>
</h4>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
<table class="table">
<tr>
<td>
10 Days of Cloud options
</td>
</tr>
<tr>
<td>
Up to 15 Cameras
</td>
</tr>
<tr>
<td>
Unlimited Support
</td>
</tr>
<tr>
<td>
$44 99 / Mo
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="col-sm-4 col-md-4">
<h4 class="panel-title">
<input type="radio" name="sex" value="male"> Basic - d<br>
</h4>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
<table class="table">
<tr>
<td>
10 Days of Cloud options
</td>
</tr>
<tr>
<td>
Up to 15 Cameras
</td>
</tr>
<tr>
<td>
Unlimited Support
</td>
</tr>
<tr>
<td>
$44 99 / Mo
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
screen 2 - mobile | uses bootstrap accordian
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne"><span class="glyphicon glyphicon-folder-close">
</span>Elite</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
<table class="table">
<tr>
<td>
60 Days of Cloud Recording
</td>
</tr>
<tr>
<td>
Up to 15 Cameras
</td>
</tr>
<tr>
<td>
Unlimited Support
</td>
</tr>
<tr>
<td>
$14 99 / Mo
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo"><span class="glyphicon glyphicon-th">
</span>PREMIER</a>
</h4>
</div>
<div id="collapseTwo" class="panel-collapse collapse">
<div class="panel-body">
<table class="table">
<tr>
<td>
60 Days of Cloud Recording
</td>
</tr>
<tr>
<td>
Up to 15 Cameras
</td>
</tr>
<tr>
<td>
Unlimited Support
</td>
</tr>
<tr>
<td>
$14 99 / Mo
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseThree"><span class="glyphicon glyphicon-user">
</span>BASIC</a>
</h4>
</div>
<div id="collapseThree" class="panel-collapse collapse">
<div class="panel-body">
<table class="table">
<tr>
<td>
60 Days of Cloud Recording
</td>
</tr>
<tr>
<td>
Up to 15 Cameras
</td>
</tr>
<tr>
<td>
Unlimited Support
</td>
</tr>
<tr>
<td>
$14 99 / Mo
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
You can also create media queries based on screen width then link them
within the head of your html doc. You would have to create separate styles for each view.
example
<link rel="stylesheet" type="text/css" media="screen and (max-device-width: 768px)" href="tablet.css" />
<link rel="stylesheet" type="text/css" media="screen and (max-device-width: 480px)" href="phone.css" />
Just hide/show divs using the css display property based on screen width.
As best practice be sure to combine all custom css into one file.
https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries

Resources