The DIVs are grouped and they are not going down when i add a text into each div
As you can see on the snippet below, the div
with the class divSection
is grouped, those div
should stay below the text (text 1, text 2, text 3) that are into the div
with the class divSection
. I could add a margin
on divSection
, but i want it to have 0 margin
when there's no content into the div
.
.divSection3, .divSection7
height: 38px;
background-color: rgba( 26, 26, 26, 0.7);
.section
text-align: center;
padding-top: 13px;
display: flex;
flex-basis: 100%;
align-items: center;
text-transform: uppercase;
.section::before,
.section::after
content: "";
flex-grow: 1;
background: rgba(255,255,255, 0.35);
height: 1px;
font-size: 0px;
line-height: 0px;
margin: 0px 8px;
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<div class="container mt-5">
<div class="row">
<div class="col-12" style="background-color: red;">
<div class="row">
<div class="divSection3 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 1</h6>
<div>
<h5>texto 1</h5>
</div>
</div>
</div>
<div class="divSection7 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 2</h6>
<div>
<h5>texto 2</h5>
</div>
</div>
</div>
<div class="divSection3 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 3</h6>
<div>
<h5>texto 3</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
This is how it should looks like:
html css twitter-bootstrap
add a comment |Â
As you can see on the snippet below, the div
with the class divSection
is grouped, those div
should stay below the text (text 1, text 2, text 3) that are into the div
with the class divSection
. I could add a margin
on divSection
, but i want it to have 0 margin
when there's no content into the div
.
.divSection3, .divSection7
height: 38px;
background-color: rgba( 26, 26, 26, 0.7);
.section
text-align: center;
padding-top: 13px;
display: flex;
flex-basis: 100%;
align-items: center;
text-transform: uppercase;
.section::before,
.section::after
content: "";
flex-grow: 1;
background: rgba(255,255,255, 0.35);
height: 1px;
font-size: 0px;
line-height: 0px;
margin: 0px 8px;
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<div class="container mt-5">
<div class="row">
<div class="col-12" style="background-color: red;">
<div class="row">
<div class="divSection3 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 1</h6>
<div>
<h5>texto 1</h5>
</div>
</div>
</div>
<div class="divSection7 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 2</h6>
<div>
<h5>texto 2</h5>
</div>
</div>
</div>
<div class="divSection3 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 3</h6>
<div>
<h5>texto 3</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
This is how it should looks like:
html css twitter-bootstrap
add a comment |Â
As you can see on the snippet below, the div
with the class divSection
is grouped, those div
should stay below the text (text 1, text 2, text 3) that are into the div
with the class divSection
. I could add a margin
on divSection
, but i want it to have 0 margin
when there's no content into the div
.
.divSection3, .divSection7
height: 38px;
background-color: rgba( 26, 26, 26, 0.7);
.section
text-align: center;
padding-top: 13px;
display: flex;
flex-basis: 100%;
align-items: center;
text-transform: uppercase;
.section::before,
.section::after
content: "";
flex-grow: 1;
background: rgba(255,255,255, 0.35);
height: 1px;
font-size: 0px;
line-height: 0px;
margin: 0px 8px;
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<div class="container mt-5">
<div class="row">
<div class="col-12" style="background-color: red;">
<div class="row">
<div class="divSection3 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 1</h6>
<div>
<h5>texto 1</h5>
</div>
</div>
</div>
<div class="divSection7 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 2</h6>
<div>
<h5>texto 2</h5>
</div>
</div>
</div>
<div class="divSection3 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 3</h6>
<div>
<h5>texto 3</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
This is how it should looks like:
html css twitter-bootstrap
As you can see on the snippet below, the div
with the class divSection
is grouped, those div
should stay below the text (text 1, text 2, text 3) that are into the div
with the class divSection
. I could add a margin
on divSection
, but i want it to have 0 margin
when there's no content into the div
.
.divSection3, .divSection7
height: 38px;
background-color: rgba( 26, 26, 26, 0.7);
.section
text-align: center;
padding-top: 13px;
display: flex;
flex-basis: 100%;
align-items: center;
text-transform: uppercase;
.section::before,
.section::after
content: "";
flex-grow: 1;
background: rgba(255,255,255, 0.35);
height: 1px;
font-size: 0px;
line-height: 0px;
margin: 0px 8px;
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<div class="container mt-5">
<div class="row">
<div class="col-12" style="background-color: red;">
<div class="row">
<div class="divSection3 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 1</h6>
<div>
<h5>texto 1</h5>
</div>
</div>
</div>
<div class="divSection7 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 2</h6>
<div>
<h5>texto 2</h5>
</div>
</div>
</div>
<div class="divSection3 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 3</h6>
<div>
<h5>texto 3</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
This is how it should looks like:
.divSection3, .divSection7
height: 38px;
background-color: rgba( 26, 26, 26, 0.7);
.section
text-align: center;
padding-top: 13px;
display: flex;
flex-basis: 100%;
align-items: center;
text-transform: uppercase;
.section::before,
.section::after
content: "";
flex-grow: 1;
background: rgba(255,255,255, 0.35);
height: 1px;
font-size: 0px;
line-height: 0px;
margin: 0px 8px;
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<div class="container mt-5">
<div class="row">
<div class="col-12" style="background-color: red;">
<div class="row">
<div class="divSection3 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 1</h6>
<div>
<h5>texto 1</h5>
</div>
</div>
</div>
<div class="divSection7 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 2</h6>
<div>
<h5>texto 2</h5>
</div>
</div>
</div>
<div class="divSection3 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 3</h6>
<div>
<h5>texto 3</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
.divSection3, .divSection7
height: 38px;
background-color: rgba( 26, 26, 26, 0.7);
.section
text-align: center;
padding-top: 13px;
display: flex;
flex-basis: 100%;
align-items: center;
text-transform: uppercase;
.section::before,
.section::after
content: "";
flex-grow: 1;
background: rgba(255,255,255, 0.35);
height: 1px;
font-size: 0px;
line-height: 0px;
margin: 0px 8px;
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<div class="container mt-5">
<div class="row">
<div class="col-12" style="background-color: red;">
<div class="row">
<div class="divSection3 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 1</h6>
<div>
<h5>texto 1</h5>
</div>
</div>
</div>
<div class="divSection7 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 2</h6>
<div>
<h5>texto 2</h5>
</div>
</div>
</div>
<div class="divSection3 col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 3</h6>
<div>
<h5>texto 3</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
html css twitter-bootstrap
html css twitter-bootstrap
edited Nov 11 at 0:07
asked Nov 11 at 0:01
Sabrina
305
305
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
Please just remove the height: 38px;
from the .divSection3, .divSection7
selectors because it is redundant.
One more thing, you shouldn't have different names for the classes because the class purpose is to have multiple items selectable with one CSS rule. For unique elements rules you should use IDs instead of classes.
Hope this helps.
add a comment |Â
How about this?
css:
.divSection
background-color: rgba( 26, 26, 26, 0.7);
h5
background-color: red;
.u-padding-top
padding-top: 5px;
.section
text-align: center;
display: flex;
flex-basis: 100%;
align-items: center;
text-transform: uppercase;
.section::before,
.section::after
content: "";
flex-grow: 1;
background: rgba(255,255,255, 0.35);
height: 1px;
html:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<div class="container mt-5">
<div class="row">
<div class="col-12" style="background-color: red;">
<div class="row">
<div class="divSection col-lg-12 u-padding-top">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 1</h6>
<div>
<h5>texto 1</h5>
</div>
</div>
</div>
<div class="divSection col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 2</h6>
<div>
<h5>texto 2</h5>
</div>
</div>
</div>
<div class="divSection col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 3</h6>
<div>
<h5>texto 3</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
UPDATED
Took off redundancy
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Please just remove the height: 38px;
from the .divSection3, .divSection7
selectors because it is redundant.
One more thing, you shouldn't have different names for the classes because the class purpose is to have multiple items selectable with one CSS rule. For unique elements rules you should use IDs instead of classes.
Hope this helps.
add a comment |Â
Please just remove the height: 38px;
from the .divSection3, .divSection7
selectors because it is redundant.
One more thing, you shouldn't have different names for the classes because the class purpose is to have multiple items selectable with one CSS rule. For unique elements rules you should use IDs instead of classes.
Hope this helps.
add a comment |Â
Please just remove the height: 38px;
from the .divSection3, .divSection7
selectors because it is redundant.
One more thing, you shouldn't have different names for the classes because the class purpose is to have multiple items selectable with one CSS rule. For unique elements rules you should use IDs instead of classes.
Hope this helps.
Please just remove the height: 38px;
from the .divSection3, .divSection7
selectors because it is redundant.
One more thing, you shouldn't have different names for the classes because the class purpose is to have multiple items selectable with one CSS rule. For unique elements rules you should use IDs instead of classes.
Hope this helps.
answered Nov 11 at 0:15
Minder Mondo
1336
1336
add a comment |Â
add a comment |Â
How about this?
css:
.divSection
background-color: rgba( 26, 26, 26, 0.7);
h5
background-color: red;
.u-padding-top
padding-top: 5px;
.section
text-align: center;
display: flex;
flex-basis: 100%;
align-items: center;
text-transform: uppercase;
.section::before,
.section::after
content: "";
flex-grow: 1;
background: rgba(255,255,255, 0.35);
height: 1px;
html:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<div class="container mt-5">
<div class="row">
<div class="col-12" style="background-color: red;">
<div class="row">
<div class="divSection col-lg-12 u-padding-top">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 1</h6>
<div>
<h5>texto 1</h5>
</div>
</div>
</div>
<div class="divSection col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 2</h6>
<div>
<h5>texto 2</h5>
</div>
</div>
</div>
<div class="divSection col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 3</h6>
<div>
<h5>texto 3</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
UPDATED
Took off redundancy
add a comment |Â
How about this?
css:
.divSection
background-color: rgba( 26, 26, 26, 0.7);
h5
background-color: red;
.u-padding-top
padding-top: 5px;
.section
text-align: center;
display: flex;
flex-basis: 100%;
align-items: center;
text-transform: uppercase;
.section::before,
.section::after
content: "";
flex-grow: 1;
background: rgba(255,255,255, 0.35);
height: 1px;
html:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<div class="container mt-5">
<div class="row">
<div class="col-12" style="background-color: red;">
<div class="row">
<div class="divSection col-lg-12 u-padding-top">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 1</h6>
<div>
<h5>texto 1</h5>
</div>
</div>
</div>
<div class="divSection col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 2</h6>
<div>
<h5>texto 2</h5>
</div>
</div>
</div>
<div class="divSection col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 3</h6>
<div>
<h5>texto 3</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
UPDATED
Took off redundancy
add a comment |Â
How about this?
css:
.divSection
background-color: rgba( 26, 26, 26, 0.7);
h5
background-color: red;
.u-padding-top
padding-top: 5px;
.section
text-align: center;
display: flex;
flex-basis: 100%;
align-items: center;
text-transform: uppercase;
.section::before,
.section::after
content: "";
flex-grow: 1;
background: rgba(255,255,255, 0.35);
height: 1px;
html:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<div class="container mt-5">
<div class="row">
<div class="col-12" style="background-color: red;">
<div class="row">
<div class="divSection col-lg-12 u-padding-top">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 1</h6>
<div>
<h5>texto 1</h5>
</div>
</div>
</div>
<div class="divSection col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 2</h6>
<div>
<h5>texto 2</h5>
</div>
</div>
</div>
<div class="divSection col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 3</h6>
<div>
<h5>texto 3</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
UPDATED
Took off redundancy
How about this?
css:
.divSection
background-color: rgba( 26, 26, 26, 0.7);
h5
background-color: red;
.u-padding-top
padding-top: 5px;
.section
text-align: center;
display: flex;
flex-basis: 100%;
align-items: center;
text-transform: uppercase;
.section::before,
.section::after
content: "";
flex-grow: 1;
background: rgba(255,255,255, 0.35);
height: 1px;
html:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<div class="container mt-5">
<div class="row">
<div class="col-12" style="background-color: red;">
<div class="row">
<div class="divSection col-lg-12 u-padding-top">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 1</h6>
<div>
<h5>texto 1</h5>
</div>
</div>
</div>
<div class="divSection col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 2</h6>
<div>
<h5>texto 2</h5>
</div>
</div>
</div>
<div class="divSection col-lg-12">
<div>
<h6 class="section text-white ml-2 mr-2 ml-lg-0 mr-lg-0">Title 3</h6>
<div>
<h5>texto 3</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
UPDATED
Took off redundancy
edited Nov 11 at 0:25
answered Nov 11 at 0:20
Angel Garcia
3051317
3051317
add a comment |Â
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f53244619%2fthe-divs-are-grouped-and-they-are-not-going-down-when-i-add-a-text-into-each-div%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