Modify all CSS styles as soon as I incorporate the Bootstrap framework

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width"> <!--Supporting All devices width-->
    <meta name="description" content="Lowa State University Library">
    <meta name="keywords" content="For a Web Design Assignment">
    <meta name="author" content="Tharuka Dananjaya">
    <link rel="stylesheet" href="./css/style.css">
    <!--<link rel="stylesheet" type="text/css" href="./css/bootstrap.css">-->


</head>
    <body>
        <header>
            <div class="container">
                <div id="head_top">
                    <h1>LOWA STATE UNIVERSITY | <span class="highlight"> LIBRARY</span></a></h1>
            </div>
            <nav>
                <ul>
                    <li>
                        <li class="current"><a href="librarian_home.php">Home</a></li>
                    <div class="dropdown">
                        <button class="button_book">Books</button>
                        <div class="dropdown-content">
                          <a href="#">Link 1</a>
                          <a href="#">Link 2</a>
                          <a href="#">Link 3</a>
                          <a href="#">Link 4</a>
                          <a href="#">Link 5</a>
                        </div>
                    </div>
                        <!--<a href="loginindex.php">Login</a>
                        <a href="registerindex.php">Register</a>-->
                        <a href="student_info.php" class="ma">Student Info</a>


                </ul>
            </nav>
        </header>
        <section id="search_bar">
                <div class="container">
                    <form>
                        <input type="text" placeholder="Search">
                        <button type="search" class="button_1">search</button>

`I have included an external CSS file and Bootstrap. The CSS stylesheet is already linked and working perfectly on my page. However, when I tried to create a table using Bootstrap, linking the Bootstrap files caused a change in all the styles, such as the header fonts and everything else. How can I successfully link both the CSS styles and Bootstrap while maintaining the desired appearance? After linking the Bootstrap file

Answer №1

To begin, make sure to include the Bootstrap style before adding your own style.css file. Here is an example:

<link rel="stylesheet" type="text/css" href="./css/bootstrap.css">
<link rel="stylesheet" href="./css/style.css">

Insert these lines in the head section of your index.html file.

Remember, the hierarchy of CSS styles is applied from bottom to top.

Answer №2

If you've created custom styles and are importing them before Bootstrap, be aware that once you import Bootstrap, it will override any classes you've defined in your CSS file.

Try importing Bootstrap before your custom CSS to see if that resolves the issue.

Unfortunately, without seeing any code, it's difficult for me to provide further assistance at this time.

Edit

<link rel="stylesheet" href="./css/style.css">
<!--<link rel="stylesheet" type="text/css" href="./css/bootstrap.css">-->

It seems like you were importing Bootstrap after your CSS rules, which means Bootstrap is taking precedence over your styles. To avoid this, switch the order of the statements so that your CSS takes priority over Bootstrap.

<link rel="stylesheet" type="text/css" href="./css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="./css/style.css">

Additionally, if you're not specifying a font-family in your CSS, Bootstrap's default will be used. Make sure to override all necessary classes and elements (body, p, div, etc.).

For more information on theming your Bootstrap instance, refer to the official Bootstrap documentation.

While debugging, check the network requests in your developer environment to ensure there are no 404 errors related to your stylesheet links. It's possible that your styles are not displaying correctly because they are not being loaded by the browser.

Answer №3

<link rel="stylesheet" type="text/css" href="./css/bootstrap.css">
<link rel="stylesheet" href="./css/style.css">

When the compiler reads code from line 1, it will prioritize the styles from bootstrap.css over style.css if they are placed in that order. Ensure to arrange your stylesheet links accordingly to avoid any overriding issues.

Answer №4

Hey Tharuka Dananjaya,
It seems like the issue you're facing is due to using external bootstrap CSS only.
Wondering how to resolve it?
1. Firstly, identify the section that is causing the problem and inspect the element to see that the browser is prioritizing bootstrap CSS over your own style.
To fix this, make that specific CSS rule as !important
eg: color:red!important;

  1. Make your styles have higher priority!
    Copy all your code from style.css and paste it into your HTML page as internal CSS, between the head and body tags.

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

I'm struggling to make the jquery parentsUntil function work properly

Would appreciate some help with using the jquery parentsUntil method to hide a button until a radio box is selected. I've been struggling with this for a few days now and can't seem to figure out what I'm doing wrong. Any insights would be g ...

Inquire regarding the header image. Can you confirm if the current HTML and CSS for this is the most efficient approach?

This is a preview of my website in progress (Disclaimer: I'm currently learning HTML to build this site, design comes next. I know it's not the conventional way to design a site, but oh well) Check out the site here Is the HTML code for the hea ...

Creating Awesome Icons in Kendo Grid with Code In this tutorial, we will learn how to programm

Looking to have a Kendo grid display a green fas-fa-clock icon if isActive is true, and a grey far-fa-clock icon if false. Clicking on the icon should toggle between true and false. Currently, the grid just shows the word true or false in the column. Cod ...

Discrepancies in media screen queries displaying on inspection tools compared to actual device

I've done some research online but I'm still struggling with this issue. Despite creating media screen queries and setting the viewport for iPhone 7 plus, the website does not display correctly on my device. When I inspect it using Chrome, every ...

Forming a header area by utilizing a 960 Grid container

I'm in the process of designing a website utilizing the 960 Grid system. The header consists of three parts: the logo, the navigation, and the login form. I've implemented media queries to center both the logo and the login section when the pag ...

Increase the space below the footer on the Facebook page to allow for an

I recently created a webpage at and noticed that it is adding extra height below the footer on my Facebook page: "" I am seeking assistance on how to remove this additional 21px height below all content in the footer. I have tried various templates but n ...

Transform the text with a stylish touch within a 'textarea' element

I am currently working on a form with the following design: At the moment, I am at this particular stage and focusing on some minor details: One issue I have encountered is that the "Your text..." appears stuck to the top left corner of the textarea. I a ...

I am trying to use jQuery to dynamically change classes based on certain conditions. However, I am encountering an issue where the class of my 'home' link remains unchanged even after clicking on another link. How

How can I modify my jQuery code to achieve the following: If the 'home page' is active, then apply CSS class A (dark green color) to the 'home link'; otherwise, apply CSS class B (brown color). (In essence, I want the relevant link to ...

jQuery can be used to relocate buttons on a webpage

When the Contact button is clicked, how can I move the Close button below #panel? It's currently fixed in position. Here's my demonstration: https://jsfiddle.net/25u78gff/ https://i.sstatic.net/qDad9.png jQuery('.sub-menu').addClass( ...

"Emphasize menu items with an underline as you navigate through the

I am using Gatsby with React and have a navigation menu with links. I would like to make it so that when a link is clicked, a border bottom appears to indicate the current page, rather than only on hover. <ul className="men" id="menu"> ...

What is the best way to align the text in the center without centering the numbers in an HTML ordered list?

I am currently working on a small widget for a webpage that displays steps in reverse order. My plan is to use an ol element and adjust the value attribute on each li tag to make the numbering of the ordered list reversed. Everything seems to be going smoo ...

How to align a button vertically centered next to a matInput using Angular Material

Is there a way to vertically center a button next to matInput in Angular material? The submit button appears too low compared to the "First Name" input field, as shown in the images below: https://i.sstatic.net/PZGAg.png https://i.sstatic.net/ZuxHc.png ht ...

Is it possible to create an animation with CSS3 transitions?

Experience a dynamic blinking border animation when hovering over the title: #link_list a:hover { border-left: 10px solid #E3E3E3; animation: blink 1s infinite; -webkit-animation: blink 1s infinite; -moz-animation: blink 1s infinite; -o-animation: blink 1 ...

Hide elements in hidden divs until the page is fully loaded to reduce initial page

www.prismasites.com I am creating a unique world map by using SVG DIVs shaped like Continents. Upon clicking on a continent on the world map, it conceals the world map DIV and displays the respective continent DIV with SVG. I have successfully achieved ...

What is the best way to add a specific class to another class in my CSS code?

Is it possible to apply a CSS class defined in css1.css to another HTML class defined in css2.css? In css1.css: div.classPredefined { border: solid 1px #000; } In css2.css: div.newClass { background: #CCC; /*apply-class: classPredefined;*/ } Although ...

Why is the media query not affecting this image?

<div class="col-lg-6" > <img src = "iphone6.png" id="dog-mobile" alt="phone"> </div> #dog-mobile{ height:600px; position: absolute; right: 25%; transform: rotate(25deg); } ...

I have a parent DIV with a child DIV, and I am looking to use jQuery to select the last child DIV. The parent DIV has an

In my HTML code, I have a parent div called "allcomments_4" which contains several child divs with unique IDs (oneEntry), each with their own children. My goal is to locate and retrieve the content inside the last child of the parent node (lastComment) and ...

Encountered an unexpected character "<" while looking for an identifier in a React.js project

Looking to expand my React skills, I decided to delve into a basic e-commerce project using Visual Studio. Unfortunately, I encountered some errors along the way: E-commerce Project Errors Here is a snippet of my index.js code: code snippet Any insight ...

Quiz application features various button states for optimal user interaction

I am in the process of creating a quiz that resembles the popular BuzzFeed quizzes such as THIS ONE. Although I have mapped out the logic and have an idea of how to code it to function similarly to the one provided in the link, I am encountering issues wit ...

employing rowspan functionality within a JavaScript application

How can I achieve a table layout where the first two columns are fixed for only one row and the remaining rows are repeated 7 times? Additionally, is there a way to make the bottom border of the last row thicker? Check out the expected table for reference. ...