39

I am new to programming and learning bootstrap through a course called One Month Rails. I want to remove the rounded corners on the inverse-navbar but am having a hard time. I have looked through both of the stackoverflow threads in the links below but still am having trouble.

Currently I have a file called "Bootstrap_and_customization.css.scss" and it has the following code:

$body-bg:   #95a5a6;
$border-radius: 0px;
@import 'bootstrap';

However, the border radius is still rounded. I hope I've provided enough information but I might not have so please let me know.

Thanks

===== Links:

Getting rid of all the rounded corners in Twitter Bootstrap

https://stackoverflow.com/questions/20926522/flat-ui-round-corners-css-html

Community
  • 1
  • 1
Faique Moqeet
  • 569
  • 1
  • 5
  • 10

12 Answers12

89

I will instead of modifying the css add the class: navbar-static-top

ie:

<nav class="navbar navbar-default navbar-static-top" role="navigation">

or the class navbar-fixed-top, if you want the menu to be fixed on the top(on large pages)

ie:

<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
Manza
  • 2,109
  • 1
  • 27
  • 34
  • This almost did the trick, but I have a navbar-right ul that is not getting positioned correctly (the text is flush against the rigth edge of the page). Everything else looks good. – lintmouse May 07 '15 at 18:36
  • 2
    Why do you have `role="navigation"` in a nav? – LostMikely Feb 12 '16 at 22:00
  • 1
    Hi Michael, this is what I found in the new bootstrap docs, hope it helps: add a role="navigation" to every navbar to explicitly identify it as a landmark region for users of assistive technologies – Manza Feb 12 '16 at 23:52
  • 1
    I searched for this, came here, and it worked. A year later: I searched for this, came here, and it worked. Thank you, and thank you. :) –  Jun 06 '17 at 03:31
26

You used:

<nav class="navbar navbar-inverse">

Try using this instead:

<nav class="navbar navbar-inverse navbar-static-top"> 

and this will remove radius

15

All you have done there is create a variable initialized to 0. I think you are best off letting Bootstrap do what it wants and then overriding what you want.

Try applying

* {
  border-radius: 0 !important;
  -moz-border-radius: 0 !important;
}

And of course make sure this style (and any other overriding styles) is included in your template files.

Vidya
  • 29,932
  • 7
  • 42
  • 70
7

On your class navbar you need to override the border-radius to 0px:

<nav class="navbar navbar-inverse" style="border-radius:0px;">

Since the html has priority over the CSS you'll be overriding the style without messing with the code.

In the other hand you could override all the "border-radius" that precede "navbar" in the "css/bootstrap.css"

Note: for border color I used: "border-color:transparent;"

Theo Leinad
  • 115
  • 1
  • 7
5

Hope this helps you.This worked for me.

<nav class="navbar navbar-inverse navbar-static-top" >

<!-- Content -->

</nav>
krekto
  • 1,403
  • 14
  • 18
4

Just add class .navbar-full like this.

<nav class="navbar navbar-dark bg-inverse navbar-full" id="nav-main">

I dont know if this work for bootstrap 3, but you can give it a try.

Yordan Ramchev
  • 340
  • 4
  • 14
2

This link has a similar question and was answered perfectly.

Bootstrap CSS can be huge and compressed. You can do 'inspect element' to find the location of the file in which the CSS property is present, then modify the parameters over there.

OR

You can write some internal CSS, i.e in the view file or application layout(If you want for all views).

In the head of the respective file write the following:

<style>
body {
background-color: #95a5a6;
border-radius: 0px;
}
</style>

If the above code does not work then you will have to specify the class of the div or element for which you want to have angle borders. In the head of the respective file write the following:

<style>
.class {
background-color: #95a5a6;
border-radius: 0px;
}
</style>

Note: Replace 'class' with a valid one.

Community
  • 1
  • 1
Shine Cardozo
  • 489
  • 5
  • 16
2

You should change the following bootstrap block:

@media (min-width: 768px) {
    .navbar {
         border-radius: 4px;
    } 
}

Just comment the border-radius property.

Pablo
  • 361
  • 3
  • 6
2

This is also a variable that can be built and downloaded or changed if you use LESS / SCSS

$navbar-border-radius: $border-radius-base !default;
Ian Warner
  • 1,058
  • 13
  • 32
2
.navbar{
border-radius:0 !important;
}

apply the style directly on the same element that contains navbar. !important will remove the style from bootstrap and make your stype more important.

Bmuzammil
  • 31
  • 9
1
<style>
.navbar{
border-radius:0px;
}
</style>

Provide these codes before or after tags so that this will override the default property.Hope this helps you.This worked for me.

0

look for the .navbar-inverse and only add {border-radius:0px;} like this .navbar-inverse {border-radius:0px;}

Robert
  • 5,278
  • 43
  • 65
  • 115