I’m facing an issue with the >div
part in my CSS selector .row > div
. It seems to be causing an error in my grid system implementation. How can I resolve this error, and what is the reason behind it?
I’m using the descendant selector because without it, the border is applied to one large box, but I want it to be applied to both columns.
[edit] columns also not being implemented when I use the margin property in the CSS rule.
/* styles.css */
.row > div {
padding: 20px;
margin: 20px;
border: 2px blue solid;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel="stylesheet" href="styles.css">
<title>Tasks</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-6 col-sm-12 for-columns">
<p> some text here </p>
</div>
<div class="col-lg-6 col-sm-12 for-columns">
<p> some text here </p>
</div>
</div>
</div>
</body>
</html>
2
Answers
You can reduce the padding of div or watch boostrap website for help.https://getbootstrap.com/
Bootstrap
Mixins in Bootstrap version 5.3 have changed. If you were using Bootstrap version 4, the mixin looked like this:
In the version you import, Mixins looks like this:
After importing bootstrap, you need to overwrite the styles.