Change order of 8 divs with bootstrapMake a div fill the height of the remaining screen spaceHow to horizontally center a <div>?How to change an element's class with JavaScript?How to make div not larger than its contents?How to align content of a div to the bottomCreating a div element in jQueryHow to make a div 100% height of the browser windowChange an HTML5 input's placeholder color with CSSHow do I auto-resize an image to fit a 'div' container?Cannot display HTML string
Booting Ubuntu from USB drive on MSI motherboard -- EVERYTHING fails
What "level" is a monster, for the Tough feat?
Airport Security - advanced check, 4th amendment breach
Isn't the detector always measuring, and thus always collapsing the state?
Can an untrusted VPN client monitor my network activity?
How do my husband and I get over our fear of having another difficult baby?
Enlightenment finding me
Job interview by video at home and privacy concerns
Why most footers have a background color as a divider of section?
Giving a good fancy look to a simple table
Disable all sound permanently
Do actions granted by the Haste spell count as "your action"?
Smallest PRIME containing the first 11 primes as sub-strings
Why does it seem the best way to make a living is to invest in real estate?
麦酒 (ばくしゅ) for "beer"
Knights and Knaves: What does C say?
How do we know neutrons have no charge?
Is the "spacetime" the same thing as the mathematical 4th dimension?
If I travelled back in time to invest in X company to make a fortune, roughly what is the probability that it would fail?
How important is knowledge of trig identities for use in Calculus
What does a textbook look like while you are writing it?
A word that refers to saying something in an attempt to anger or embarrass someone into doing something that they don’t want to do?
Is there a pattern for handling conflicting function parameters?
Is there an in-universe explanation of how Frodo's arrival in Valinor was recorded in the Red Book?
Change order of 8 divs with bootstrap
Make a div fill the height of the remaining screen spaceHow to horizontally center a <div>?How to change an element's class with JavaScript?How to make div not larger than its contents?How to align content of a div to the bottomCreating a div element in jQueryHow to make a div 100% height of the browser windowChange an HTML5 input's placeholder color with CSSHow do I auto-resize an image to fit a 'div' container?Cannot display HTML string
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
I have 8 divs, on desktop and tablet there should be 4 divs side by side, with links that open a div underneath all 4 at full width. on mobile i want the div thats opened by the link to display underneath the div with the corresponding link.
At first I tried a function
function resize()
if($(window).width() < 480)
$("#service1").insertAfter("#service-box1");
Now I'm trying to do so with bootstrap, but I don't know which version should be used or how exactly to do it with 8 divs.
Here's the html in desktop order
<div id="services-container" class="row">
<div class="service" id="service-box1">
<h1>Title</h1>
<a class="learn-more" id="show1" data-href="service1">Learn More</a>
</div>
<div class="service" id="service-box2">
<h1>Title</h1>
<a class="learn-more" id="show2" data-href="service2">Learn More</a>
</div>
<div class="service" id="service-box3">
<h1>Title</h1>
<a class="learn-more" id="show3" data-href="service3">Learn More</a>
</div>
<div class="service" id="service-box4">
<h1>Title</h1>
<a class="learn-more" id="show4" data-href="service4">Learn More</a>
</div>
<div class="service-content" id="service-content1">
<h1>Service1</h1>
</div>
<div class="service-content" id="service-content2">
<h1>Service2</h1>
</div>
<div class="service-content" id="service-content3">
<h1>Service3</h1>
</div>
<div class="service-content" id="service-content4">
<h1>Service4</h1>
</div>
</div>
Here's the html in mobile order
<div id="services-container" class="row">
<div class="service" id="service-box1">
<h1>Title</h1>
<a class="learn-more" id="show1" data-href="service1">Learn More</a>
</div>
<div class="service-content" id="service-content1">
<h1>Service1</h1>
</div>
<div class="service" id="service-box2">
<h1>Title</h1>
<a class="learn-more" id="show2" data-href="service2">Learn More</a>
</div>
<div class="service-content" id="service-content2">
<h1>Service2</h1>
</div>
<div class="service" id="service-box3">
<h1>Title</h1>
<a class="learn-more" id="show3" data-href="service3">Learn More</a>
</div>
<div class="service-content" id="service-content3">
<h1>Service3</h1>
</div>
<div class="service" id="service-box4">
<h1>Title</h1>
<a class="learn-more" id="show4" data-href="service4">Learn More</a>
</div>
<div class="service-content" id="service-content4">
<h1>Service4</h1>
</div>
</div>
This is how it should display on desktop:
https://imgur.com/IJPUOhi
This is how it should display on mobile (screens 669px and below):
https://imgur.com/8B7BUVx
html
add a comment
|
I have 8 divs, on desktop and tablet there should be 4 divs side by side, with links that open a div underneath all 4 at full width. on mobile i want the div thats opened by the link to display underneath the div with the corresponding link.
At first I tried a function
function resize()
if($(window).width() < 480)
$("#service1").insertAfter("#service-box1");
Now I'm trying to do so with bootstrap, but I don't know which version should be used or how exactly to do it with 8 divs.
Here's the html in desktop order
<div id="services-container" class="row">
<div class="service" id="service-box1">
<h1>Title</h1>
<a class="learn-more" id="show1" data-href="service1">Learn More</a>
</div>
<div class="service" id="service-box2">
<h1>Title</h1>
<a class="learn-more" id="show2" data-href="service2">Learn More</a>
</div>
<div class="service" id="service-box3">
<h1>Title</h1>
<a class="learn-more" id="show3" data-href="service3">Learn More</a>
</div>
<div class="service" id="service-box4">
<h1>Title</h1>
<a class="learn-more" id="show4" data-href="service4">Learn More</a>
</div>
<div class="service-content" id="service-content1">
<h1>Service1</h1>
</div>
<div class="service-content" id="service-content2">
<h1>Service2</h1>
</div>
<div class="service-content" id="service-content3">
<h1>Service3</h1>
</div>
<div class="service-content" id="service-content4">
<h1>Service4</h1>
</div>
</div>
Here's the html in mobile order
<div id="services-container" class="row">
<div class="service" id="service-box1">
<h1>Title</h1>
<a class="learn-more" id="show1" data-href="service1">Learn More</a>
</div>
<div class="service-content" id="service-content1">
<h1>Service1</h1>
</div>
<div class="service" id="service-box2">
<h1>Title</h1>
<a class="learn-more" id="show2" data-href="service2">Learn More</a>
</div>
<div class="service-content" id="service-content2">
<h1>Service2</h1>
</div>
<div class="service" id="service-box3">
<h1>Title</h1>
<a class="learn-more" id="show3" data-href="service3">Learn More</a>
</div>
<div class="service-content" id="service-content3">
<h1>Service3</h1>
</div>
<div class="service" id="service-box4">
<h1>Title</h1>
<a class="learn-more" id="show4" data-href="service4">Learn More</a>
</div>
<div class="service-content" id="service-content4">
<h1>Service4</h1>
</div>
</div>
This is how it should display on desktop:
https://imgur.com/IJPUOhi
This is how it should display on mobile (screens 669px and below):
https://imgur.com/8B7BUVx
html
add a comment
|
I have 8 divs, on desktop and tablet there should be 4 divs side by side, with links that open a div underneath all 4 at full width. on mobile i want the div thats opened by the link to display underneath the div with the corresponding link.
At first I tried a function
function resize()
if($(window).width() < 480)
$("#service1").insertAfter("#service-box1");
Now I'm trying to do so with bootstrap, but I don't know which version should be used or how exactly to do it with 8 divs.
Here's the html in desktop order
<div id="services-container" class="row">
<div class="service" id="service-box1">
<h1>Title</h1>
<a class="learn-more" id="show1" data-href="service1">Learn More</a>
</div>
<div class="service" id="service-box2">
<h1>Title</h1>
<a class="learn-more" id="show2" data-href="service2">Learn More</a>
</div>
<div class="service" id="service-box3">
<h1>Title</h1>
<a class="learn-more" id="show3" data-href="service3">Learn More</a>
</div>
<div class="service" id="service-box4">
<h1>Title</h1>
<a class="learn-more" id="show4" data-href="service4">Learn More</a>
</div>
<div class="service-content" id="service-content1">
<h1>Service1</h1>
</div>
<div class="service-content" id="service-content2">
<h1>Service2</h1>
</div>
<div class="service-content" id="service-content3">
<h1>Service3</h1>
</div>
<div class="service-content" id="service-content4">
<h1>Service4</h1>
</div>
</div>
Here's the html in mobile order
<div id="services-container" class="row">
<div class="service" id="service-box1">
<h1>Title</h1>
<a class="learn-more" id="show1" data-href="service1">Learn More</a>
</div>
<div class="service-content" id="service-content1">
<h1>Service1</h1>
</div>
<div class="service" id="service-box2">
<h1>Title</h1>
<a class="learn-more" id="show2" data-href="service2">Learn More</a>
</div>
<div class="service-content" id="service-content2">
<h1>Service2</h1>
</div>
<div class="service" id="service-box3">
<h1>Title</h1>
<a class="learn-more" id="show3" data-href="service3">Learn More</a>
</div>
<div class="service-content" id="service-content3">
<h1>Service3</h1>
</div>
<div class="service" id="service-box4">
<h1>Title</h1>
<a class="learn-more" id="show4" data-href="service4">Learn More</a>
</div>
<div class="service-content" id="service-content4">
<h1>Service4</h1>
</div>
</div>
This is how it should display on desktop:
https://imgur.com/IJPUOhi
This is how it should display on mobile (screens 669px and below):
https://imgur.com/8B7BUVx
html
I have 8 divs, on desktop and tablet there should be 4 divs side by side, with links that open a div underneath all 4 at full width. on mobile i want the div thats opened by the link to display underneath the div with the corresponding link.
At first I tried a function
function resize()
if($(window).width() < 480)
$("#service1").insertAfter("#service-box1");
Now I'm trying to do so with bootstrap, but I don't know which version should be used or how exactly to do it with 8 divs.
Here's the html in desktop order
<div id="services-container" class="row">
<div class="service" id="service-box1">
<h1>Title</h1>
<a class="learn-more" id="show1" data-href="service1">Learn More</a>
</div>
<div class="service" id="service-box2">
<h1>Title</h1>
<a class="learn-more" id="show2" data-href="service2">Learn More</a>
</div>
<div class="service" id="service-box3">
<h1>Title</h1>
<a class="learn-more" id="show3" data-href="service3">Learn More</a>
</div>
<div class="service" id="service-box4">
<h1>Title</h1>
<a class="learn-more" id="show4" data-href="service4">Learn More</a>
</div>
<div class="service-content" id="service-content1">
<h1>Service1</h1>
</div>
<div class="service-content" id="service-content2">
<h1>Service2</h1>
</div>
<div class="service-content" id="service-content3">
<h1>Service3</h1>
</div>
<div class="service-content" id="service-content4">
<h1>Service4</h1>
</div>
</div>
Here's the html in mobile order
<div id="services-container" class="row">
<div class="service" id="service-box1">
<h1>Title</h1>
<a class="learn-more" id="show1" data-href="service1">Learn More</a>
</div>
<div class="service-content" id="service-content1">
<h1>Service1</h1>
</div>
<div class="service" id="service-box2">
<h1>Title</h1>
<a class="learn-more" id="show2" data-href="service2">Learn More</a>
</div>
<div class="service-content" id="service-content2">
<h1>Service2</h1>
</div>
<div class="service" id="service-box3">
<h1>Title</h1>
<a class="learn-more" id="show3" data-href="service3">Learn More</a>
</div>
<div class="service-content" id="service-content3">
<h1>Service3</h1>
</div>
<div class="service" id="service-box4">
<h1>Title</h1>
<a class="learn-more" id="show4" data-href="service4">Learn More</a>
</div>
<div class="service-content" id="service-content4">
<h1>Service4</h1>
</div>
</div>
This is how it should display on desktop:
https://imgur.com/IJPUOhi
This is how it should display on mobile (screens 669px and below):
https://imgur.com/8B7BUVx
html
html
asked Mar 28 at 20:21
dulhacdulhac
487 bronze badges
487 bronze badges
add a comment
|
add a comment
|
1 Answer
1
active
oldest
votes
Your best bet would be to use flexbox, in conjunction with its flex-order css attribute.
An example:
.container
display: flex;
flex-direction: row;
flex-wrap: wrap;
.box1,
.box2,
.box3,
.box4
width: 25%;
background-color: grey;
.box5
width: 100%;
background-color: grey;
@media (max-width: 400px)
.box1
order: 1;
.box2
order: 3;
.box3
order: 4;
.box4
order: 5;
.box5
order: 2;
.box1,
.box2,
.box3,
.box4
width: 100%;
<div class="container">
<div class="box1">box 1</div>
<div class="box2">box 2</div>
<div class="box3">box 3</div>
<div class="box4">box 4</div>
<div class="box5">box 5</div>
</div>
That's exactly what I needed, thank you!
– dulhac
Mar 28 at 21:08
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406247%2fchange-order-of-8-divs-with-bootstrap%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your best bet would be to use flexbox, in conjunction with its flex-order css attribute.
An example:
.container
display: flex;
flex-direction: row;
flex-wrap: wrap;
.box1,
.box2,
.box3,
.box4
width: 25%;
background-color: grey;
.box5
width: 100%;
background-color: grey;
@media (max-width: 400px)
.box1
order: 1;
.box2
order: 3;
.box3
order: 4;
.box4
order: 5;
.box5
order: 2;
.box1,
.box2,
.box3,
.box4
width: 100%;
<div class="container">
<div class="box1">box 1</div>
<div class="box2">box 2</div>
<div class="box3">box 3</div>
<div class="box4">box 4</div>
<div class="box5">box 5</div>
</div>
That's exactly what I needed, thank you!
– dulhac
Mar 28 at 21:08
add a comment
|
Your best bet would be to use flexbox, in conjunction with its flex-order css attribute.
An example:
.container
display: flex;
flex-direction: row;
flex-wrap: wrap;
.box1,
.box2,
.box3,
.box4
width: 25%;
background-color: grey;
.box5
width: 100%;
background-color: grey;
@media (max-width: 400px)
.box1
order: 1;
.box2
order: 3;
.box3
order: 4;
.box4
order: 5;
.box5
order: 2;
.box1,
.box2,
.box3,
.box4
width: 100%;
<div class="container">
<div class="box1">box 1</div>
<div class="box2">box 2</div>
<div class="box3">box 3</div>
<div class="box4">box 4</div>
<div class="box5">box 5</div>
</div>
That's exactly what I needed, thank you!
– dulhac
Mar 28 at 21:08
add a comment
|
Your best bet would be to use flexbox, in conjunction with its flex-order css attribute.
An example:
.container
display: flex;
flex-direction: row;
flex-wrap: wrap;
.box1,
.box2,
.box3,
.box4
width: 25%;
background-color: grey;
.box5
width: 100%;
background-color: grey;
@media (max-width: 400px)
.box1
order: 1;
.box2
order: 3;
.box3
order: 4;
.box4
order: 5;
.box5
order: 2;
.box1,
.box2,
.box3,
.box4
width: 100%;
<div class="container">
<div class="box1">box 1</div>
<div class="box2">box 2</div>
<div class="box3">box 3</div>
<div class="box4">box 4</div>
<div class="box5">box 5</div>
</div>Your best bet would be to use flexbox, in conjunction with its flex-order css attribute.
An example:
.container
display: flex;
flex-direction: row;
flex-wrap: wrap;
.box1,
.box2,
.box3,
.box4
width: 25%;
background-color: grey;
.box5
width: 100%;
background-color: grey;
@media (max-width: 400px)
.box1
order: 1;
.box2
order: 3;
.box3
order: 4;
.box4
order: 5;
.box5
order: 2;
.box1,
.box2,
.box3,
.box4
width: 100%;
<div class="container">
<div class="box1">box 1</div>
<div class="box2">box 2</div>
<div class="box3">box 3</div>
<div class="box4">box 4</div>
<div class="box5">box 5</div>
</div>.container
display: flex;
flex-direction: row;
flex-wrap: wrap;
.box1,
.box2,
.box3,
.box4
width: 25%;
background-color: grey;
.box5
width: 100%;
background-color: grey;
@media (max-width: 400px)
.box1
order: 1;
.box2
order: 3;
.box3
order: 4;
.box4
order: 5;
.box5
order: 2;
.box1,
.box2,
.box3,
.box4
width: 100%;
<div class="container">
<div class="box1">box 1</div>
<div class="box2">box 2</div>
<div class="box3">box 3</div>
<div class="box4">box 4</div>
<div class="box5">box 5</div>
</div>.container
display: flex;
flex-direction: row;
flex-wrap: wrap;
.box1,
.box2,
.box3,
.box4
width: 25%;
background-color: grey;
.box5
width: 100%;
background-color: grey;
@media (max-width: 400px)
.box1
order: 1;
.box2
order: 3;
.box3
order: 4;
.box4
order: 5;
.box5
order: 2;
.box1,
.box2,
.box3,
.box4
width: 100%;
<div class="container">
<div class="box1">box 1</div>
<div class="box2">box 2</div>
<div class="box3">box 3</div>
<div class="box4">box 4</div>
<div class="box5">box 5</div>
</div>answered Mar 28 at 20:37
HybridHybrid
3,9732 gold badges10 silver badges32 bronze badges
3,9732 gold badges10 silver badges32 bronze badges
That's exactly what I needed, thank you!
– dulhac
Mar 28 at 21:08
add a comment
|
That's exactly what I needed, thank you!
– dulhac
Mar 28 at 21:08
That's exactly what I needed, thank you!
– dulhac
Mar 28 at 21:08
That's exactly what I needed, thank you!
– dulhac
Mar 28 at 21:08
add a comment
|
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406247%2fchange-order-of-8-divs-with-bootstrap%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown