Transitioning from Tailored CSS to Bootstrap

While I am experienced in HTML and CSS, I am new to working with Bootstrap. Here is a code snippet that works well but has a lot of custom CSS. Below you can see my HTML and CSS code.

.container {
  padding: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rectangle {
  width: 632px;
  height: 269px;
  padding: 30px 20px;
  border-radius: 4px;
  border: solid 1px #e0e0e0;
  background-color: #ffffff;
  text-align: center;
  display: flex;
  display: ms-flexbox;
  align-items: center;
  justify-content: center;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
}

.title {
  width: 291px;
  height: 54px;
  font-size: 49px;
  font-weight: normal;
  font-style: normal;
  font-stretch: normal;
  line-height: 1.1;
  letter-spacing: -0.8px;
  text-align: center;
  color: #333333;
  -ms-flex: 0 0 100%;
  flex: 0 0 100%;
  max-width: 100%;
}

.description {
  width: 468px;
  height: 23px;
  font-size: 18px;
  font-weight: normal;
  font-style: normal;
  font-stretch: normal;
  line-height: 1.28;
  letter-spacing: -0.03px;
  color: #333333;
  -ms-flex: 0 0 100%;
  flex: 0 0 100%;
  max-width: 100%;
}

.button {
  width: 303px;
  height: 48px;
  border-radius: 4px;
  background-color: #f9c940 !important;
  color: #000000;
  font-size: 20px;
}
<div class="container">
  <div class="rectangle">
    <div class="title">
      <p>Title</p>
    </div>
    <div class="description">
      <p>Description</p>
    </div>
    <div>
      <button class="button">Start</button>
    </div>
  </div>
</div>

I am looking for ways to make the above code more responsive by using Bootstrap. How can I transform the custom CSS into Bootstrap code efficiently? Your assistance would be greatly appreciated.

Answer №1

Did you switch classes from custom to bootstrap after integrating bootstrap?

For example, if you have a button with a custom class name, add the bootstrap class of button btn btn-warning to see the changes.

.container {
  padding: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rectangle {
  width: 632px;
  height: 269px;
  padding: 30px 20px;
  border-radius: 4px;
  border: solid 1px #e0e0e0;
  background-color: #ffffff;
  text-align: center;
  display: flex;
  display: ms-flexbox;
  align-items: center;
  justify-content: center;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
}

.title {
  width: 291px;
  height: 54px;
  font-size: 49px;
  font-weight: normal;
  font-style: normal;
  font-stretch: normal;
  line-height: 1.1;
  letter-spacing: -0.8px;
  text-align: center;
  color: #333333;
  -ms-flex: 0 0 100%;
  flex: 0 0 100%;
  max-width: 100%;
}

.description {
  width: 468px;
  height: 23px;
  font-size: 18px;
  font-weight: normal;
  font-style: normal;
  font-stretch: normal;
  line-height: 1.28;
  letter-spacing: -0.03px;
  color: #333333;
  -ms-flex: 0 0 100%;
  flex: 0 0 100%;
  max-width: 100%;
}

.button {
  width: 303px;
  height: 48px;
  border-radius: 4px;
  background-color: #f9c940 !important;
  color: #000000;
  font-size: 20px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

<div class="container">
  <div class="card rectangle">
    <div class="title card-body">
      <p>Title</p>
    
    <div class="description">
      <p>Description</p>
    </div>
    <div>
      <button class="button btn btn-warning">Start</button>
      </div>
    </div>
  </div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Beginner in CSS wanting to set background image for input field

I am working on incorporating icons into my project. The image I have contains an array of 16x16 icons at this URL: "http://www.freepbx.org/v3/browser/trunk/assets/css/jquery/vader/images/ui-icons_cd0a0a_256x240.png?rev=1" Does anyone know how I can selec ...

Tips on extracting information from a list of website links

I have been working on a project to extract information from various websites and store it in a JSON file. The desired output format is as follows : [ { "title": "Python developer", "place": "Slovensko ...

The image fails to load once the AI-generated image is complete and the response process has concluded

After a long hiatus from development, I am diving back in and acknowledging the rustiness of my skills. Any syntax or formatting errors encountered are preemptively apologized for. Currently, I am immersed in a small web app project that involves taking a ...

Using Selenium in Python, loop through webpages to extract the search result position

Currently, I am using a script to search for a generic keyword and determine the rank of my products on an e-commerce platform. The code below has been working successfully in fetching the product ranks on the first page. from selenium import webdriver dr ...

Leverage the power of Reactjs to add hover effects to a mapped

I am facing a challenge in styling the ListItem on hover. The issue arises when the list is dynamically generated, causing all list items to change style simultaneously when hovered over. How can I target only one element for styling? Below is the code sni ...

Effortlessly sleek horizontal navigation bar designed with Liquid CSS

I've been exploring online tutorials to create a responsive horizontal drop-down menu navigation bar using just CSS and HTML. The tutorial process has been smooth so far, but I'm aiming to make my navigation bar fluid so that it adjusts seamlessl ...

Is there a way to modify CSS class names on-the-fly within an Angular project?

I am working with two CSS classes named as below: .icon_heart{ color: #bdbdbd; } .icon_heart_red{ color: #a6b7d4;; } Within my HTML code, I have incorporated a heart icon. <div class="icon_heart" *ngIf="showheartIcon"> ...

Outdated JavaScript Alert

Is it possible to use JavaScript to create an alert message in my input field when a past date is selected? I would like the warning to say "past date, please enter a valid date." <html lang="en"> <head> <meta charset="U ...

Content on the right floating underneath content on the left

Here is the HTML code snippet I am working with: <div id="main_content"> <div id="left_side> <h1> MY BIG HEADER </h1> </div> <div id="content_area"> SOME CONTENT HERE SOME CONTENT HERE S ...

Rendering HTML with Apache Tiles using an empty <a></a> tag

Having encountered a peculiar issue with HTML lately. In my backend, the problematic section looks like this. <div class="content"> <a href="detail.html"></a> <img src="assets/i ...

Adjust the Weight of a Single Word in H1 CSS

I've been trying to figure out how to achieve the following for a while now. I know I can solve this issue by using different h1 tags and positioning them separately, but I'm curious to find out if there's a way to do it without dividing the ...

Don't let noise linger in the background unnoticed

Within my HTML table, there are 32 cells that each possess an onclick="music()" function. This function is currently functioning correctly, with one small exception. I desire for the functionality to be such that whenever I click on a different cell, the m ...

Having issues with the basic KnockoutJS binding not functioning as expected

There appears to be an issue with my KnockoutJS script that I'm struggling to pinpoint. Below is the snippet of HTML code: <h2>SendMessage</h2> <div class="form-group" id="messageSender"> <label>Select User Type</l ...

Fixing the Jquery animation glitch triggered by mouseover and mouseout

In my project, I have implemented a small mouseover and mouseout functionality. The challenge I am facing is that I need to keep the mouseout function using animate() instead of css() for specific reasons. The issue arises when I quickly do a mouseover fo ...

What is the method for incorporating a dotted line preceding the menu options?

I am currently working on an asp.net menu that looks like this: <div id="left"> <div id="menus" runat="server"> <div id="left_menu"> <div class="abc"> < ...

Retrieving the chosen option using a change event listener

Is there a way to retrieve the selected option using a change listener in TypeScript? I have come across JavaScript examples where the value is retrieved through event., but I am unable to locate any field that contains the selected option. <!DOCTYPE ...

Is it possible to enhance a form box with a border?

Having trouble adding a border to my bootstrap form box. I've tried applying border style properties but it doesn't seem to be working. Any suggestions? This is the class for the form box: <div class="form-box"> <div ...

Navbar collapse not functioning properly on HTML, CSS, and JavaScript

I have developed a CSS code snippet: .nav{ right: 0px; left: 0px; margin-top: 0px; margin-bottom:20px; height: 35px; text-align: center; background-color: red; z-index: 1; } .sticky { background: #000; text-align: center; ...

The transparency of the TABLE must only be applied to a specific section

I need the table to have a transparent bottom and a clear top for better readability. Here is my attempted solution: .preview { background: -moz-linear-gradient(top, rgba(255,255,255,0) 25%, rgba(255,255,255) 100%); background: -webkit-gradie ...

Looking to enhance the size of pagination icons for previous and next pages on a Material-UI React table?

I am looking to adjust the size of the previous page and next page icons in a material table implemented in React. Below is the code snippet: localization = { { body : {} , toolbar: { searchTooltip: 'Search'} , pagination: ...