Home > Web Front-end > Bootstrap Tutorial > Does bootstrap css conflict?

Does bootstrap css conflict?

爱喝马黛茶的安东尼
Release: 2019-07-17 10:22:51
Original
3652 people have browsed it

Bootstrap is the most popular CSS framework on the Web. It makes creating beautiful, responsive designs very easy. However, sometimes you don't want to use Bootstrap on the entire website and you only need to use a part of the Bootstrap CSS. If you just add Bootstrap CSS directly to the head, it may conflict with other CSS, resulting in confusing styles.

Does bootstrap css conflict?

#If we can isolate Bootstrap CSS to a specific class, the problem is solved! Just use LESS to add a class name to all Bootstrap CSS.

LESS is a CSS processor that allows you to change variables before compiling to CSS. This allows you to change one variable (e.g. base font size) and LESS will automatically adjust all styles that depend on it (e.g. line height, headings, etc.).

The following shows how to use LESS to customize bootstrap CSS, and then use the class bootstrap-iso to add prefixes to all Bootstrap styles.

Related recommendations: "bootstrap Getting Started Tutorial"

Processing steps:

1. Import the bootstrap css file in the head tag

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
Copy after login
Replace

with

<link rel="stylesheet" href="https://formden.com/static/assets/demos/bootstrap-iso/bootstrap-iso/bootstrap-iso.css" />
Copy after login

2. Then wrap the HTML in a div with class bootstrap-iso like this:

<div class="bootstrap-iso">
<!-- Any HTML here will be styled with Bootstrap CSS -->
</div>
Copy after login

The above is the detailed content of Does bootstrap css conflict?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template