I am really liking Bootstrap 3 and it looks like Sitepoint got a Bootstrap redesign too? Is this correct?
Anyways, I am looking to have my Bootstrap fixed topnav menu to be bigger with a logo and styled links on desktop view and smaller with a resized logo on mobile view . Can this be done?
Also, I looked at the source code of Bootstrap’s website and they use “./” instead of “/” for sourcing. “./” for example will be the link to the homepage and I’ve never seen this before. Any ideas why they use the period before the slash and if there are benefits to doing so?
Anyways, I am looking to have my Bootstrap fixed topnav menu to be bigger with a logo and styled links on desktop view and smaller with a resized logo on mobile view . Can this be done?
It would be up to you to over-ride the default menu (assuming you are using the default menus) with your own css files. You can change the height to what ever you want in the normal way. Or just find a template closer to your design and modify that.
Or do you have a demo page up already to look at?
Also, I looked at the source code of Bootstrap’s website and they use “./” instead of “/” for sourcing. “./” for example will be the link to the homepage and I’ve never seen this before. Any ideas why they use the period before the slash and if there are benefits to doing so?
Do you have an example?
/ = root relative
./ = start at the current directory
…/ = up one level relative to current directory
…/…/ = up two levels relative to current directory
Notice that for the mobile dropdown, it’s not the same colour as the lighter gray desktop navigation. I’m looking at the code and Bootstrap 3 docs but can’t find any mention of how to do that. It seems like the examples on Bootstrap 3 components page are using the same colours for desktop / mobile navigation. (With the same rollover effects on both too)
The way I did it was simply to use the standard bootstrap and then modify the code to suit. If you close the window until the dropdown appears then you can highlight the menu in Firebug (other developer tools are available) and see what styles are being applied and then just over-ride them in your custom stylesheet (don’t touch the bootstrap files).
I use a program called CSS terminal to test out styles on the fly and once happy just copy and paste it into the real stylesheet. For example install CSS terminal and then just paste the following in the CSS terminal window of the site you linked to.
#header .mobile-menu {background:red}
#header .mobile-menu li{background:blue}
#header .mobile-menu .menu-down li a{display:block}
#header .mobile-menu .menu-down li a:hover{background:green}
Then go into the mobile with and the colours are all changed. It doesn’t take long to customise a menu to your own designs that way.
I don’t have these id’s or classes in my HTML markup (#header, .mobile-menu). If I create these will I need to have duplicate navigation markup for a mobile menu as well as a desktop menu in order to skin them separately?
You misunderstood me a little. The code I posted refers to the site you posted as an example. I was just showing how relatively easy it is to re-style an existing menu (within limits)
Just use the classes from your own menu and over-ride the default with the css in your own custom css file. If you do as I mention above you can make changes and see the result and work out what needs to be changed at each stage as you may need to cancel out styles that you don’t need.
Or alternatively create your own menu but then you will have to start from scratch, apply your own media queries and dropdown styles, which then defeats some of the reasons for using bootstrap in the first place.
I can’t offer specific advice without seeing your page and the design you need to repliate.
And sorry this may sound like a silly question, but is it possible make a div with a background image responsive using Bootstrap?
I’m using a class on my H1 to replace it with an background image using some fancy Photoshop effects on the text. I don’t think I should be using pixels for the width and height. I see the pre-built “img-responsive” class in Bootstrap 3 but it only seems to work on <img>'s. Any idea if responsive can be done for div background-images too?
Here is the HTML:
<h1 class=“homepage hide-text”>Welcome</h1>
And here is the CSS:
h1.homepage {background:url(…/images/h1-homepage.png);width:350px;height:55px;}
/* Better than text-indent -9999px for hiding text */
.hide-text {text-indent:100%;white-space:nowrap;overflow:hidden;}
Thanks! So in the methods article that you linked to I scrolled down to the bit about “Adding a background image” and utilized their example as follows:
That looks correct but just use a span if you don’t like the code in the example. An empty span will do no harm and you can still do your usual image replacement technique.
If it’s not working put up an example and we’ll try to debug further.