DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Choosing the Best CSS Frameworks for Enterprise Web Applications
  • Why You Might Need To Know Algorithms as a Mobile Developer: Emoji Example
  • How To Integrate a Web Component Into a Mobile App While Preserving Native UX
  • Is Your Internet of Things Fully Online?

Trending

  • Implementing API Design First in .NET for Efficient Development, Testing, and CI/CD
  • How to Merge HTML Documents in Java
  • Supervised Fine-Tuning (SFT) on VLMs: From Pre-trained Checkpoints To Tuned Models
  • The Role of AI in Identity and Access Management for Organizations
  1. DZone
  2. Coding
  3. Frameworks
  4. Bootstrap Responsive Grid for Desktop and Mobile

Bootstrap Responsive Grid for Desktop and Mobile

By 
Tousif  Khan user avatar
Tousif Khan
·
Apr. 09, 15 · Interview
Likes (1)
Comment
Save
Tweet
Share
29.2K Views

Join the DZone community and get the full member experience.

Join For Free

the bootstrap grid layout system is simple to use, it provides style classes that can be used to create different kinds of grid layout, ranging from one to twelve columns and with support for responsive layouts (where the layout of the grid changes based on the width of the screen, allowing the same content to be laid out on mobile and desktop devices). with the new bootstrap 3 version, it design with the “mobile first” approach so you don’t need to include a separate css to support mobile instead mobile first styles can be found throughout the entire library.

to ensure proper rendering and touch zooming, add the viewport meta tag to your <head>.

<meta name="viewport" content="width=device-width, initial-scale=1">

you can disable zooming capabilities on mobile devices by adding user-scalable=no to the viewport meta tag.

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

creating responsive grids

the main use for responsive grids is to allow mobile devices and desktops to display the same content, taking advantage of whatever screen space is available. to create a responsive grid, use the col-* class on individual cells with one of the classes shown in table below.

when the width of the screen is less than the class supports, the cells in the grid row are placed vertically rather than horizontally. following is a html code to demonstrate the responsive grid.

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>twitter bootstrap responsive grid</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/bootstrap.css" rel="stylesheet" />
<link href="css/bootstrap-theme.css" rel="stylesheet" />
<style>
	#gridcontainer { padding: 20px; }
	.grid-row > div { 
		border: 1px solid lightgrey;
		padding: 10px;
		background-color: aliceblue;
		margin: 5px 0; 
	}
</style>
</head>
<body>

<div class="panel">
	<h3 class="panel-header">grid layout</h3>
	<div id="gridcontainer">
		<div class="row grid-row">
			<div class="col-sm-3">3</div>
			<div class="col-sm-4">4</div>
			<div class="col-sm-5">5</div>
		</div>
		<div class="row grid-row">
			<div class="col-sm-6">6</div>
			<div class="col-sm-6">6</div>
		</div>
		<div class="row grid-row">
			<div class="col-sm-11">11</div>
			<div class="col-sm-1">1</div>
		</div>
	</div>
</div>

</body>
</html>

output:

desktop version

mobile version


mobile Desktop (word processor) Bootstrap (front-end framework)

Opinions expressed by DZone contributors are their own.

Related

  • Choosing the Best CSS Frameworks for Enterprise Web Applications
  • Why You Might Need To Know Algorithms as a Mobile Developer: Emoji Example
  • How To Integrate a Web Component Into a Mobile App While Preserving Native UX
  • Is Your Internet of Things Fully Online?

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!