-2

I am using Bootstrap 4 for my project and I need to add some div to my project. Problem is this div element created using Bootstrap 3. Is there any way to use Bootstrap 3 for specific div?

<html>

  <head>
    <!--use Bootstrap 4 js and css-->
  </head>

   <!--Start to use Bootstrap 3 js and css-->
   <div>
   </div>
   <!--Stop to use Bootstrap 3 js and css-->

</html>
13
  • Problem is this div element created using Bootstrap 3....Uhh, actually you create the HTML elements, so you have the full control over them. So, what is the question? It seems very unclear, at least to me...Please read How to create a Minimal, Complete, and Verifiable example Commented Jul 20, 2017 at 7:48
  • 1
    Assign an id to the div and change the css only for that div Commented Jul 20, 2017 at 7:49
  • I haven't tried, but I think you shouldn't be mixing different versions of Bootstrap in the same page. Commented Jul 20, 2017 at 7:52
  • @Ionut He wants to include twitter-bootstrap3 only for a selected element not for entire page. I guess Commented Jul 20, 2017 at 7:54
  • @AbhishekPandey Yes exactly what I want to do. Commented Jul 20, 2017 at 7:56

1 Answer 1

1

First and foremost, if that is the website structure you got it is incorrect, and a proper structure can look something like this:

<!DOCTYPE html>
<html>
  <head>
     <title>My First Website</title>
     <meta charset="UTF-8"/>
     
     <!-- Any required CSS or JS files goes here -->
  </head>
  <body>
  <!-- Page content goes here -->
  </body>
</html>

Apart from that, Bootstrap does indeed have CSS classes including "div", however, most of what it does requires you to give a class to an element in order for anything to happen. If it does anything else, you should double check in what order you are linking your CSS files since it does matter, and if that doesn't help, make specific classes yourself in your own CSS file to override it.

Sign up to request clarification or add additional context in comments.

4 Comments

I already said that I am using Bootstrap 4. How can you use both Bootstrap 3 and 4 with your example code?
Ah, I didn't understand that at first. Mixing Bootstrap 4 and Bootstrap 3 is not something you should be doing, like others have stated. Bootstrap 3 might be more tested, but as far as my own experience goes Bootstrap 4 is a lot better. Choose one and stick to it. @hellzone
Problem is this div has hundreds of html elements and none of them looking fine with bootstrap 4. So I can not create custom css for all of them. Isn't there any other way?
@hellzone Like earlier stated, if you load in your CSS files in the correct order, you should get your desired look. If not, you could always do something like this

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.