flexbox justify-content multiple tags underneath eachother [duplicate]
This question already has an answer here:
Flexbox: center horizontally and vertically
10 answers
I have a div with a h1 and h2 tag in it, my goal is to center them horizontally and vertically I am using flexbox but this is how my code acts
--------------
| |
| h1h2 |
| |
--------------
my goal is this
--------------
| |
| h1 |
| h2 |
| |
--------------
my html:
<div class="announcement">
<h1>h1</h1>
<h2>h2</h2>
</div>
my css:
.announcement {
display: flex;
align-items: center;
justify-content: center;
}
I've tried doing a <br> after the <h1> but doesnt do anyhting
html css flexbox
marked as duplicate by Temani Afif
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 25 '18 at 12:54
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Flexbox: center horizontally and vertically
10 answers
I have a div with a h1 and h2 tag in it, my goal is to center them horizontally and vertically I am using flexbox but this is how my code acts
--------------
| |
| h1h2 |
| |
--------------
my goal is this
--------------
| |
| h1 |
| h2 |
| |
--------------
my html:
<div class="announcement">
<h1>h1</h1>
<h2>h2</h2>
</div>
my css:
.announcement {
display: flex;
align-items: center;
justify-content: center;
}
I've tried doing a <br> after the <h1> but doesnt do anyhting
html css flexbox
marked as duplicate by Temani Afif
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 25 '18 at 12:54
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Flexbox: center horizontally and vertically
10 answers
I have a div with a h1 and h2 tag in it, my goal is to center them horizontally and vertically I am using flexbox but this is how my code acts
--------------
| |
| h1h2 |
| |
--------------
my goal is this
--------------
| |
| h1 |
| h2 |
| |
--------------
my html:
<div class="announcement">
<h1>h1</h1>
<h2>h2</h2>
</div>
my css:
.announcement {
display: flex;
align-items: center;
justify-content: center;
}
I've tried doing a <br> after the <h1> but doesnt do anyhting
html css flexbox
This question already has an answer here:
Flexbox: center horizontally and vertically
10 answers
I have a div with a h1 and h2 tag in it, my goal is to center them horizontally and vertically I am using flexbox but this is how my code acts
--------------
| |
| h1h2 |
| |
--------------
my goal is this
--------------
| |
| h1 |
| h2 |
| |
--------------
my html:
<div class="announcement">
<h1>h1</h1>
<h2>h2</h2>
</div>
my css:
.announcement {
display: flex;
align-items: center;
justify-content: center;
}
I've tried doing a <br> after the <h1> but doesnt do anyhting
This question already has an answer here:
Flexbox: center horizontally and vertically
10 answers
html css flexbox
html css flexbox
edited Nov 25 '18 at 14:02
Yashwardhan Pauranik
2,06111629
2,06111629
asked Nov 25 '18 at 12:49
Miklo VubaMiklo Vuba
32
32
marked as duplicate by Temani Afif
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 25 '18 at 12:54
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Temani Afif
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 25 '18 at 12:54
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Give flex-direction: column;. As by default, the flex layout is direction is row
.announcement {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
1
Awesome! Thank you very much!
– Miklo Vuba
Nov 25 '18 at 13:01
@MikloVuba Welcome, Please accept the answer also.
– Yashwardhan Pauranik
Nov 25 '18 at 13:02
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Give flex-direction: column;. As by default, the flex layout is direction is row
.announcement {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
1
Awesome! Thank you very much!
– Miklo Vuba
Nov 25 '18 at 13:01
@MikloVuba Welcome, Please accept the answer also.
– Yashwardhan Pauranik
Nov 25 '18 at 13:02
add a comment |
Give flex-direction: column;. As by default, the flex layout is direction is row
.announcement {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
1
Awesome! Thank you very much!
– Miklo Vuba
Nov 25 '18 at 13:01
@MikloVuba Welcome, Please accept the answer also.
– Yashwardhan Pauranik
Nov 25 '18 at 13:02
add a comment |
Give flex-direction: column;. As by default, the flex layout is direction is row
.announcement {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
Give flex-direction: column;. As by default, the flex layout is direction is row
.announcement {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
answered Nov 25 '18 at 12:53
Yashwardhan PauranikYashwardhan Pauranik
2,06111629
2,06111629
1
Awesome! Thank you very much!
– Miklo Vuba
Nov 25 '18 at 13:01
@MikloVuba Welcome, Please accept the answer also.
– Yashwardhan Pauranik
Nov 25 '18 at 13:02
add a comment |
1
Awesome! Thank you very much!
– Miklo Vuba
Nov 25 '18 at 13:01
@MikloVuba Welcome, Please accept the answer also.
– Yashwardhan Pauranik
Nov 25 '18 at 13:02
1
1
Awesome! Thank you very much!
– Miklo Vuba
Nov 25 '18 at 13:01
Awesome! Thank you very much!
– Miklo Vuba
Nov 25 '18 at 13:01
@MikloVuba Welcome, Please accept the answer also.
– Yashwardhan Pauranik
Nov 25 '18 at 13:02
@MikloVuba Welcome, Please accept the answer also.
– Yashwardhan Pauranik
Nov 25 '18 at 13:02
add a comment |