Solved

navbar images

Posted on 2013-05-28
3
199 Views
Last Modified: 2013-05-29
In bootstrap can i add rollover images to the nav bar or is it easier to custom make do this myself.

I did a custom menu with images as it works fine without issues but is there an easier way with bootstrap built in classes?

body{

margin:0;
padding:0;
line-height: 1.5em;
background-color:#96d4ff;
text-align:center;
 
}

#wrapper{
  max-width:980px;
   margin:auto;
 background-color :#dadbe5;
 border :1px solid gray;
}

 #heading{
	 height:240px;
	 /* width:980px;*/
	  background-size:100% 100%;
	  background-image:url(../img/head7.png);
	  background-repeat:no-repeat;
 }
 
 
 img, embed, object, video {

  max-width: 100%;
   
}

#head2 ul li 
{
     display: inline;
 }



#head2 ul
{
/*margin-left: 15%;*/
padding:0;
list-style-type: none;
border:none;
margin: 0;
float: right;
}	


#head2 ul li.welcome2 a {

  background:url(../img/redGrad.png); 100% 100% repeat-x;
  width:100px;
  height:50px;
	 
	 }
#head2 ul li.welcome2 a:hover {
	 background:url(../img/redGrad2.png); 100% 100% repeat-x;
  width:100px;
  height:50px;
  
}

#head2 ul li a
	{
	text-decoration: none;
	float:left;
	margin:0;
	border-right:grey solid 1px;

	}

<body>
<div id="wrapper">

<div class="container-fluid">
   
    <div class="row-fluid">
     
          <div class='span12'>
          <div id="heading">
          this is my heading
          </div>
          
          </div>
     </div>
          
          
   
    <div class="row-fluid">
     
          <div class='span12'>
   
     <div id="head2">
  <ul >
    <li class="welcome2"><a href="home.html"></a></li>
    <li class="welcome2"><a href="home.html"></a></li>
      <li class="welcome2"><a href="home.html"></a></li>
    <li class="welcome2"><a href="home.html"></a></li>
    <li class="welcome2"><a href="home.html"></a></li>
    <li class="welcome2"><a href="home.html"></a></li>
      <li class="welcome2"><a href="home.html"></a></li>
    <li class="welcome2"><a href="home.html"></a></li>
    <li class="welcome2"><a href="home.html"></a></li>
  </ul>
</div>

     </div>
     
      <div class="row-fluid">
     
     
      <div class='span6 main'>
          <h2>Sidebar</h2>
         fsdfsdfd sdfsd ddfd dsfffffffffffffffffffffffffffffffff f fsdfsdfd sdfsd ddfd dsfffffffffffffffffffffffffffffffff f
      </div>
      <div class='span6 sidebar'>
        <h2>Sidebar</h2>
        fsdfsdfd sdfsd ddfd dsfffffffffffffffffffffffffffffffff f fsdfsdfd sdfsd ddfd dsfffffffffffffffffffffffffffffffff f
     </div>
     </div>
    
	</div>
</div>
     
</div>

</body>
</html>

Open in new window

0
Comment
Question by:jagguy
  • 2
3 Comments
 
LVL 15

Expert Comment

by:Jagadishwor Dulal
ID: 39201259
What is your background image?? Can you post image also.
0
 
LVL 15

Accepted Solution

by:
Jagadishwor Dulal earned 500 total points
ID: 39201294
As your image name it seems it must be gradient background you can skip it just using gradient background in css like:

#head2 ul li.welcome2 a {

background: #a90329; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2E5MDMyOSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjQ0JSIgc3RvcC1jb2xvcj0iIzhmMDIyMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM2ZDAwMTkiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top,  #a90329 0%, #8f0222 44%, #6d0019 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a90329), color-stop(44%,#8f0222), color-stop(100%,#6d0019)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  #a90329 0%,#8f0222 44%,#6d0019 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  #a90329 0%,#8f0222 44%,#6d0019 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  #a90329 0%,#8f0222 44%,#6d0019 100%); /* IE10+ */
background: linear-gradient(to bottom,  #a90329 0%,#8f0222 44%,#6d0019 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a90329', endColorstr='#6d0019',GradientType=0 ); /* IE6-8 */
width:100px;
height:50px;
color:#fff;
	 
	 }
#head2 ul li.welcome2 a:hover {
 background: #6d0019; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzZkMDAxOSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjYwJSIgc3RvcC1jb2xvcj0iIzhmMDIyMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNhOTAzMjkiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top,  #6d0019 0%, #8f0222 60%, #a90329 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6d0019), color-stop(60%,#8f0222), color-stop(100%,#a90329)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  #6d0019 0%,#8f0222 60%,#a90329 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  #6d0019 0%,#8f0222 60%,#a90329 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  #6d0019 0%,#8f0222 60%,#a90329 100%); /* IE10+ */
background: linear-gradient(to bottom,  #6d0019 0%,#8f0222 60%,#a90329 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6d0019', endColorstr='#a90329',GradientType=0 ); /* IE6-8 */
  width:100px;
  height:50px;
  color:#fff;

  
}

Open in new window


See reference site for gradient background.
http://www.colorzilla.com/gradient-editor/
0
 

Author Comment

by:jagguy
ID: 39203429
Thanks for that. I guess it isnt obvious why the css3 code is better as it looks like a lot more work and it just does a gradient.
I want to use an image which may not be a gradient.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Box Model and Styling 12 21
SVG Logo 4 20
Glyph icons in Bootstrap 3 4 16
Help cleaning out CSS 2 31
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now