Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
When I execute an HTML file in Visual Studio Code and I write Flexbox Bootstrap Code in Visual Studio Code some code doesn't run

What I have tried:

<div class="parent d-flex flex-wrap" >
    <div>item1</div>
    <div>item2</div>
    <div>item3</div>
    <div>item4</div>
</div>
<br/>
<div class="parent d-flex-justify-content-start" >
    <div>item1</div>
    <div>item2</div>
    <div>item3</div>
    <div>item4</div>
</div>
<br/>
<div class="parent d-flex-justify-content-end" >
    <div>item1</div>
    <div>item2</div>
    <div>item3</div>
    <div>item4</div>
</div>
<br/>
<div class="parent d-flex-justify-content-center" >
    <div>item1</div>
    <div>item2</div>
    <div>item3</div>
    <div>item4</div>
</div>
<br/>
<div class="parent d-flex-justify-content-between" >
    <div>item1</div>
    <div>item2</div>
    <div>item3</div>
    <div>item4</div>
</div>
Posted
Updated 23-Aug-19 3:18am
Comments
Richard Deeming 23-Aug-19 9:12am    
Well, fix it so it does run then!

If you want someone here to help you, you're going to need to provide a better explanation of the problem. Remember, we can't see your screen, access your computer, or read your mind. The only information we have to work with is what you tell us.

1 solution

First, you should use Bootstrap 4.0 or above to get flex support.

Second, try this:



HTML
<style>
.parent { background: blue; }

.child {
  background: grey;
  height: 50px;
}
</style>

<div class="parent d-flex flex-wrap" >
    <div class="child m-1">item1</div>
    <div class="child m-1">item2</div>
    <div class="child m-1">item3</div>
    <div class="child m-1">item4</div>
</div>
<br/>
<div class="parent d-flex justify-content-start" >
    <div class="child m-1">item1</div>
    <div class="child m-1">item2</div>
    <div class="child m-1">item3</div>
    <div class="child m-1">item4</div>
</div>
<br/>
<div class="parent d-flex justify-content-end" >
    <div class="child m-1">item1</div>
    <div class="child m-1">item2</div>
    <div class="child m-1">item3</div>
    <div class="child m-1">item4</div>
</div>
<br/>
<div class="parent d-flex justify-content-center" >
    <div class="child m-1">item1</div>
    <div class="child m-1">item2</div>
    <div class="child m-1">item3</div>
    <div class="child m-1">item4</div>
</div>
<br/>
<div class="parent d-flex justify-content-between" >
    <div class="child m-1">item1</div>
    <div class="child m-1">item2</div>
    <div class="child m-1">item3</div>
    <div class="child m-1">item4</div>
</div>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900