I'm currently working on a project that has two columns with text, headings and buttons. I would like to keep the design responsive, but when our client adds more text to "Step 3" the SVG doesn't line up correctly.
My thoughts
I would like to remove the SVG and set "anchor" points to the paragraph text boxes and create a curved dotted line between those anchor points.
The question is:
How do I achieve this?
Click to view image
I tried to use an SVG and scale it with the content, but this didn't work as expected.
After watching different solutions on forums, I didn't succeed in finding a solution.
This is the structure of the bock seen on the screenshot.
I am using Tailwindcss for my styling.
<section class="container mx-auto background mb-52">
<div class="flex flex-row">
<div class="flex flex-col justify-center relative max-w-[534px]">
<img class=" max-w-[534px] max-h-[575px]" src="https://via.placeholder.com/534x575.png" alt="">
</div>
<div class="ml-28 flex flex-row">
<div class="max-w-[315px]">
<!-- Item 1 -->
<div class="text-left p-3">
<div class="">
<h1 class="text-xl py-2"><span class="font-bold">1. </span>TITLE</h1>
<p class="font-roboto font-light">
text
</p>
</div>
<div class="py-4 flex flex-wrap">
Online strategie
Vindbaarheid
Webdesign
</div>
</div>
<!-- Item 3 -->
<div class="text-left p-3 ">
<div class="">
<h1 class="text-xl py-2"><span class="font-bold">3. </span>TITLE</h1>
<p class="font-roboto font-light">
Text
</p>
</div>
<div class="py-4 flex flex-wrap">
Klantportalen
</div>
</div>
<!-- Item 5 -->
<div class="text-left p-3 ">
<div class="">
<h1 class="text-xl py-2"><span class="font-bold">5. </span>TITLE</h1>
<p class="font-roboto font-light">
Text
</p>
</div>
<div class="py-4 flex flex-wrap">
Conversie optimalisatie
</div>
</div>
</div>
<!-- Col IMG -->
<div class="my-auto max-h-[764px] max-w-[100px] flex flex-col justify-center">
<img class="w-full" src="{{ asset('storage/images/curvy-line.svg') }}" alt="">
</div>
<div class="my-auto max-w-[315px]">
<!-- Item 2 -->
<div class="text-left p-3 ">
<div class="">
<h1 class="text-xl py-2"><span class="font-bold">2. </span>TITLE</h1>
<p class="font-roboto font-light">
Text
</p>
</div>
<div class="py-4 flex flex-wrap">
Koppelingen
E-Commerce
Productconfiguratoren
</div>
</div>
<!-- Item 4 -->
<div class="text-left p-3 ">
<div class="">
<h1 class="text-xl py-2"><span class="font-bold">4. </span>TITLE</h1>
<p class="font-roboto font-light">
Text
</p>
</div>
<div class="py-4 flex flex-wrap">
Bedrijfapps
Dashboarding
</div>
</div>
</div>
</div>
</div>
</section>
Related
I'm working with columns in a Django app using Bootstrap for styling.
I have been able to use classes to produce a responsive configuration which stacks vertically beyond a specified breakpoint.
I now want to introduce a space or gutter between the columns that is maintained when the columns are stacked vertically.
<div class="container">
<div class="row justify-content-center" style="margin-top: -100px;">
<!-- LEFT -->
<div class="col-md-4 border rounded bg-light">
<div class="row justify-content-center">
<h5 class="text-center"> Some text here </h5>
</div>
<br>
</div>
<!-- RIGHT -->
<div class="col-md-4 border rounded bg-white">
<div class="row justify-content-center">
<h3 class="text-center"> Some text here</h3>
<h2 class="text-center">Some text here</h2>
<p class="text-center" style="font-size: 11px;">Some text here</p>
</div>
</div>
<br>
</div>
</div>
Normal sizing
Responsive sizing
Desired outcome normal
Desired outcome responsive
I have tried implementing gutters as per the Bootstrap documentation however nothing seems to introduce the spacing required.
Any guidance greatly appreciated.
You put the styling border rounded bg-light in the wrong element. The styling should be put on the element within the .col.
.col class use padding CSS to produce the horizontal spacing and padding is within the border of element, that's the reason why your current styling didn't work.
Hope it helps and Happy coding !
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<h5 class="text-center text-decoration-underline">Original Result</h5>
<div class="container">
<div class="row justify-content-center">
<!-- LEFT -->
<div class="col-md-4 border rounded bg-light">
<div class="row justify-content-center">
<h5 class="text-center"> Some text here </h5>
</div>
<br>
</div>
<!-- RIGHT -->
<div class="col-md-4 border rounded bg-white">
<div class="row justify-content-center">
<h3 class="text-center"> Some text here</h3>
<h2 class="text-center">Some text here</h2>
<p class="text-center" style="font-size: 11px;">Some text here</p>
</div>
</div>
<br>
</div>
</div>
<h5 class="text-center text-decoration-underline">Restructured Result</h5>
<div class="container mt-3">
<div class="row justify-content-center">
<!-- LEFT -->
<div class="col-md-4">
<div class="border rounded bg-light h-100">
<h5 class="text-center"> Some text here </h5>
</div>
</div>
<br>
<!-- RIGHT -->
<div class="col-md-4">
<div class="border rounded bg-white h-100">
<h3 class="text-center"> Some text here</h3>
<h2 class="text-center">Some text here</h2>
<p class="text-center" style="font-size: 11px;">Some text here</p>
</div>
</div>
<br>
</div>
</div>
i'm using bootstrap 5 and the images are not getting aligned in horizontal way. The image gets added in the lower row. i've tried everything nut it dosent's works. any help would be appriciated.
Thank you.
<!-- Bootstrap-5 -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" />
<!-- Body -->
<section>
<div class="container pt-3" class="text1">
<div class="row">
<div class="col-12 text-center ">
<h3> Lots of IT companies in town. Why you should choose us? </h3>
</div>
</div>
</div>
<hr>
</section>
<div class="row">
<div class="col-md-4 text-center">
<img class="img-fluid p-2" src="https://via.placeholder.com/200.jpg" width="150">
<h4 style="font-weight: 700;">Customized requirements</h4>
<p> Every idea is unique and that's we craft it as<br> per your requirements.</p>
</div>
</div>
<div class="col-md-4 text-center">
<img class="img-fluid p-2" src="https://via.placeholder.com/200.jpg" width="150">
<h4 style="font-weight: 700;">Customized requirements</h4>
<p> Every idea is unique and that's we craft it as<br> per your requirements.</p>
</div>
</section>
row div early close
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" />
<section>
<div class="container pt-3" class="text1">
<div class="row">
<div class="col-12 text-center ">
<h3> Lots of IT companies in town. Why you should choose us? </h3>
</div>
</div>
</div>
<hr>
</section>
<div class="container" class="text1">
<section>
<div class="row">
<div class="col-md-4 text-center">
<img class="img-fluid p-2" src="images/our qualities/our_qualities/customized.png" width="150">
<h4 style="font-weight: 700;">Customized requirements</h4>
<p> Every idea is unique and that's we craft it as<br> per your requirements.</p>
</div> <!-- Not Here -->
<div class="col-md-4 text-center">
<img class="img-fluid p-2" src="images/our qualities/our_qualities/customized.png" width="150">
<h4 style="font-weight: 700;">Customized requirements</h4>
<p> Every idea is unique and that's we craft it as<br> per your requirements.</p>
</div>
</div> <!-- Close Here -->
</section>
</div>
I have the following piece of code and I am use bootstrap 5:
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"/>
<br><br>
<div class="list-group-item d-flex flex-row">
<div class="flex-column">
<h4>A Test Recipe</h4>
<p>This is simply a test</p>
</div>
<div class="flex-row align-self-center justify-content-end">
<img src="https://cdn.pixabay.com/photo/2016/06/15/19/09/food-1459693_1280.jpg"
alt="A Test Recipe"
style="max-height: 50px !important">
</div>
</div>
I'm trying to get the image to the end of list-group-item div. I tried using justify-content-end but this has no effect. I also tried align-self-end this also doesn't bring the image to the right side.
And as for the div with the flex-column class I'm trying to vertically center its content. But it's not working either, it should be centered like the image is. I got the image vertically centered by making use of the align-self-center class. However when I apply this class to the div that has flex-column class it doesn't work.
What am I doing wrong?
؟
<linkhref="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"/>
<div class="list-group-item d-flex justify-content-center align-items-center flex-wrap">
<div class="card m-3 border-0" style="max-width: 250px;">
<div class="row g-0">
<div class="col-5">
<img src="https://cdn.pixabay.com/photo/2016/06/15/19/09/food-1459693_1280.jpg"
class="img-fluid rounded-5"
alt="A Test Recipe">
</div>
<div class="col-7">
<div class="card-body">
<h5 class="card-title">A Test Recipe </h5>
<p class="card-text">This is simply a test.</p>
</div>
</div>
</div>
</div>
</div>
try this.
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"/>
<br><br>
<div class="list-group-item d-flex justify-content-center align-items-center flex-wrap">
<div class="card m-3 border-0" style="max-width: 350px;">
<div class="row g-0">
<div class="col-5">
<img src="https://cdn.pixabay.com/photo/2016/06/15/19/09/food-1459693_1280.jpg"
class="img-fluid rounded-3"
alt="A Test Recipe">
</div>
<div class="col-7">
<div class="card-body">
<h5 class="card-title">A Test Recipe </h5>
<p class="card-text">This is simply a test.</p>
</div>
</div>
</div>
</div>
</div>
I want the 'title' to start right above 'first yeah', the image should also start there
I've tried several ways (and with some classes) but I haven't succeeded
The card code:
<div class="card border-dark">
<div class="card-body" style="background-color: #706747;">
<h1 class="card-title">
<p class="text-body">
<img src="/assets/logo.gif" alt="" width="60" height="48" class="d-inline-block">
{{cosos}} title
</p>
</h1>
<br>
<div class="d-flex flex-nowrap bd-highlight justify-content-center">
<div class="order-1 p-2 bd-highlight">First flex item</div>
<div class="order-2 p-2 bd-highlight">Second</div>
<div class="order-3 p-2 bd-highlight">Third</div>
<div class="order-4 p-2 bd-highlight">Final yup</div>
</div>
</div>
</div>
I'm using Bootstrap 5 for everything, I have no classes or styles of my own
Step 1: remove class justify-content-center and add p-2 after class card-title. Now you will see your logo.gif and title will align with first nav bar item.
Step 2: Add place-self: center; to the div with class card-body.
Step 3: Assign background-color: #706747; to the class card, remove from card-body div.
The updated HTML will be like this:
<div class="card border-dark" style="background-color: #706747;">
<div class="card-body" style="place-self: center;">
<h1 class="card-title p-2">
<p class="text-body">
<img src="/assets/logo.gif" alt="" width="60" height="48" class="d-inline-block"> {{cosos}} title
</p>
</h1>
<div class="d-flex flex-nowrap bd-highlight ">
<div class="order-1 p-2 bd-highlight">First flex item</div>
<div class="order-2 p-2 bd-highlight">Second</div>
<div class="order-3 p-2 bd-highlight">Third</div>
<div class="order-4 p-2 bd-highlight">Final yup</div>
</div>
</div>
</div>
You can make use of the grid-layout of bootstrap to align the elements.
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
</head>
<body>
<div class="card border-dark">
<div class="card-body" style="background-color: #706747;">
<h1 class="card-title">
<p class="text-body">
<div class="row">
<div class="col-3">
</div>
<div class="col-2">
<img src="/assets/logo.gif" alt="" width="60" height="48" >
</div>
<div class="col-7">
<span id="title1"> fdasdstitle</span>
</div>
</div>
</p>
</h1>
<br>
<div class="d-flex flex-nowrap bd-highlight justify-content-center">
<div class="order-1 p-2 bd-highlight">First flex item</div>
<div class="order-2 p-2 bd-highlight">Second</div>
<div class="order-3 p-2 bd-highlight">Third</div>
<div class="order-4 p-2 bd-highlight">Final yup</div>
</div>
</div>
</div>
</body>
</html>
I'm building a responsive page layout using Bootstrap 4 and want to modify the alignment of two nested columns based on the size of the browser window.
The project is a pricing page that displays a list of features below each of three options.
On larger screens (md, lg, xl) all three pricing plans are arranged in columns, and the features for each plan are displayed one-by-one below the plan info. For smaller screens (xs, xm) I'd like to split the feature list into two columns and have them show side-by-side.
I've looked around for solutions that support this use case but haven't been able to find anything just yet.
I'm attempting to solve this issue using vanilla Bootstrap 4 in an HTML document using the built-in breakpoints. I've attempted to solve this issue using flexbox in addition to standard sizing classes and so far nothing has worked. (Note that I'm still pretty new to flexbox.)
NOTE: The solution I'm looking for is related to the two columns displaying "feature 1", "feature 2," and so on. The encompassing plan columns are currently rendering properly, but the feature columns are not.
<!-- PRICING PLANS -->
<div class="bg-primary p-3 my-5">
<div class="container">
<div class="row">
<!-- Package 1 -->
<div class="col-md h-100 bg-white p-3">
<div class="d-flex flex-column">
<div class="mb-3 bg-success text-center">
<p>Package 1</p>
<p>$29.99</p>
</div>
<div class="bg-success">
<!-- THIS IS MY CURRENT (NON-WORKING) SOLUTION: -->
<div class="col-6 col-md-12">
<p>feature 1</p>
<p>feature 2</p>
<p>feature 3</p>
</div>
<div class="col-6 col-md-12">
<p>feature 4</p>
<p>feature 5</p>
<p>feature 6</p>
</div>
</div>
</div>
</div>
<!-- REMAINDER OF CODE FOR DISPLAY PURPOSES ONLY -->
<!-- Package 2 -->
<div class="col-md h-md-100 mx-md-4 my-md-0 my-4 bg-white p-3">
<div class="d-flex flex-column">
<div class="mb-3 bg-success text-center">
<p>Package 2</p>
<p>$19.99</p>
</div>
<div class="bg-success">
<p>features</p>
</div>
</div>
</div>
<!-- Package 3 -->
<div class="col-md h-md-100 bg-white p-3">
<div class="d-flex flex-column">
<div class="mb-3 bg-success text-center">
<p>Package 3</p>
<p>$9.99</p>
</div>
<div class="bg-success">
<p>features</p>
</div>
</div>
</div>
</div>
</div>
`
I thought that by making the columns have a col-xs-6 property they would align horizontally up until hititng col-md-12 -- however they aren't showing up any differently regardless of window size.
It's happening because bg-success in your non-working example is not a flex parent (display: flex). In this example, I put an extra class on it that makes it a flex parent and you get the desired output.
.make-flex {
display: flex;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<!-- PRICING PLANS -->
<div class="bg-primary p-3 my-5">
<div class="container">
<div class="row">
<!-- Package 1 -->
<div class="col-md h-100 bg-white p-3">
<div class="d-flex flex-column">
<div class="mb-3 bg-success text-center">
<p>Package 1</p>
<p>$29.99</p>
</div>
<div class="bg-success make-flex">
<!-- THIS IS MY CURRENT (NON-WORKING) SOLUTION: -->
<div class="col-6 col-md-12">
<p>feature afaa</p>
<p>feature 2</p>
<p>feature 3</p>
</div>
<div class="col-6 col-md-12">
<p>feature 4</p>
<p>feature 5</p>
<p>feature 6</p>
</div>
</div>
</div>
</div>
<!-- REMAINDER OF CODE FOR DISPLAY PURPOSES ONLY -->
<!-- Package 2 -->
<div class="col-md h-md-100 mx-md-4 my-md-0 my-4 bg-white p-3">
<div class="d-flex flex-column">
<div class="mb-3 bg-success text-center">
<p>Package 2</p>
<p>$19.99</p>
</div>
<div class="bg-success">
<p>features</p>
</div>
</div>
</div>
<!-- Package 3 -->
<div class="col-md h-md-100 bg-white p-3">
<div class="d-flex flex-column">
<div class="mb-3 bg-success text-center">
<p>Package 3</p>
<p>$9.99</p>
</div>
<div class="bg-success">
<p>features</p>
</div>
</div>
</div>
</div>
</div>
I explored a suggestion offered by #disinfor that led to my figuring out a solution.
My solution is to add two properties to the parent div: d-flex and flex-md-column.
Just d-flex alone results in strange behavior. It's the addition of flex-md-column that appears to create the proper rendering output.
<div class="col-md h-100 bg-white p-3">
<div class="d-flex flex-column">
<div class="mb-3 bg-success text-center">
<p>Startup Package</p>
<p>Best value for startups</p>
<p>$19.99</p>
</div>
<div class="d-flex flex-md-column bg-success">
<div class="col-6 col-md-12">
<p>feature 1</p>
<p>feature 2</p>
<p>feature 3</p>
</div>
<div class="col-xs-6 col-md-12">
<p>feature 4</p>
<p>feature 5</p>
<p>feature 6</p>
</div>
</div>
</div>
</div>
Simple answer - You don't have a correct order of nesting your columns.
The order is as follows
container → row → col → row → col → and so on.
Solution? Just add row to <div class="row bg-success">
<div class="row bg-success">
<!-- THIS IS MY CURRENT (NON-WORKING) SOLUTION: -->
<div class="col-6 col-md-12">
SEE MORE: DOCUMENTATION