CSS - How to display dropdown text in one row?
Tags: html,css,menu,drop-down-menu
Problem :
I'm building a dropdown menu and I've got an issue showed on this img:
I want the "2.1" text to be displayed next to the "Item" text. For some reaason, every new word gets a new line.
Here's the html:
<ul id='nav'>
<li><a href='/'>Item 1</a></li>
<li><a href='/'>Item 2</a>
<ul>
<li><a href='/'>Item 2.1</a></li>
</ul>
</li>
<li><a href='/'>Item 3</a></li>
<li><a href='/'>Item 4</a></li>
<li><a href='/'>Item 5</a></li>
</ul>
And here's the CSS:
#nav {
list-style: none;
}
#nav li {
float: left;
position: relative;
}
#nav li a {
display: block;
text-decoration: none;
text-align: center;
background: #ccc;
margin-right: 5px;
}
#nav li ul {
position: absolute;
}
#nav li ul li {
display: block;
}
#nav li ul li a {
padding: 0px 10px;
height: 20px;
text-align: left;
background: #999;
}
Thanks for any help, Mike.
Solution :
An easy way to fix this is adding a nowrap property to #nav li ul li a
:
#nav li ul li a {
padding: 0px 10px;
height: 20px;
text-align: left;
background: #999;
white-space: nowrap; /* Forbids text wrapping */
}
CSS Howto..
You have a wrong sequence in link function Instead of link: function(element, scope) { Change it to link: function(scope, element, attrs) { Then you can directly do element.addClass as jQLite...
In your css: .align-profile, .align-contact { display: inline-block; vertical-align: top; //also can try other align settings width: 45%; } .align-contact { margin-left: 30px; //also try depending on the spacing you...
JS var selectedEffect="explode"; var options = { percent: 100 }; $('#showdiv1').click(function () { $('div[id^=div]').hide(); $('#div1').show( selectedEffect, options, 500, callback ); }); $('#showdiv2').click(function () { $('div[id^=div]').hide(); $('#div2').show( selectedEffect, options, 500, callback...
You can use display flex and order like this: <div class="container"> <div>element 1</div> <div>element 2</div> </div> .container{ display:flex; flex-direction: column; } .container div:nth-child(1){ order:2; } .container div:nth-child(2){ order:1; } //change...
Give your .navigation ul a width and use margin:0 auto; .navigation ul { list-style: none; padding: 0; width: 400px; margin: 0 auto; } ...
Try this: http://jsfiddle.net/0k698ga2/2/ I used this piece of CSS. Hope it helps. #main{ width:100%; display:table; //table-layout:fixed; border:1px solid red; position:relative; } ul{ list-style:none; padding:0;margin:0; // overflow-y:scroll; height:100%; } #left {...
Use like this: li{ float: none !important; float: left \9 !important;/* \9 is used after left not after important*/ } !important should always be at the end....
Thank you all for answers. I think it's not possible to do this correctly, but if I in mistake then respond this with correct answer. I moved #header background to...
Bare minimum code (not optimized, polished, loved, given an education, or otherwise treated kindly): $('a.boldhim').click(function () { $('a.boldthislink').addClass('current'); }); $('a.unboldhim').click(function () { $('a.boldthislink').removeClass('current'); }); Make sure you're calling it inside...
It's really going to depend on your screen. The smallest picture element is the pixel (hence its name); since all sizes are going to be converted into pixels in the...
As far as I understand from your question you need <p> below your logo so clear your float after the logo div My Fiddle <div style="clear: both;"></div> <div class='tagline'> <p>Fast...
View in JSFiddle Use following jQuery code $(document).ready(function() { $("button").click(function() { $(this).toggleClass("close"); }); }); ...
When you use .wrap :not(.section) .text, this is what you're telling the browser: Look for an element with a class of .text which lives inside an element that does not...
First you put one Div element for whole content set width as 100% and indise div for img tag 50% and Button 50% .It should work CSS: #needdiv { width:100%;...
Found this function in the Firefox source: nsCSSRenderingBorders. I don't understand the code, but the answer probably lies in there. http://mxr.mozilla.org/mozilla-central/source/layout/base/nsCSSRenderingBorders.cpp...
Try this: #plusimage{ float:left; } #plussignmsg{ font-size:10px; display: block; float:left; } Lately I found display the container as table,and contents as table-cell also works....
To achieve that you have to use table structure which mean make the li tag act as table and content act as tabel-cell and icon act as another table cell....
Just do like this HTML <table style='width: 150px; border: 1px solid black;'> <tr> <td>blablabla</td> <td>blablabla</td> </tr> <tr> <td>abcd</td> <td>abcd</td> </tr> </table> CSS table { width:600px!important; border:1px solid black; } ...
The \ character has special meaning; it is used to escape characters. If you want to match a single \ character, you will need to use two of them \\:...
The JQueryUI example includes a stylesheet. Try adding in between your head tags: <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" /> ...
Without your markup, it's a bit of an educated guess, but after looking at the owl carousel demo, I believe I can help. The elements are addressed in this CSS...
When resizeble columns are rendered, a span element is inserted on every th element as follows: <span class="ui-column-resizer ui-draggable" style="position: relative;"> </span> This span captures the resize events. You can highlight...
You can define a CSS class for your inputs and just use them. For inputs with class example: input.example { border: none; font-size: 16px; } Use it like this: <input...
Well, assuming you want quick yet efficient answer, I'll share my view of how to use CSS files and CSS in general, it's not really related to controls or ASP.NET...
Figured it out if anyone's interested. Tldr: call reflow() on the chart after showing. I was using hide() and show() instead of tabs as per @Grzegorz Blachliński's comment, so the...
From my best guess, you can't. That's why CSS3 added that functionality, because CSS2 couldn't do it on its own. There are several CSS framworks that add that functionality. As...
Remember that comma-separated selectors are treated "as new" and do not depend on previous selectors. You should use: #menu ol, #menu ul.
Have a look at this DEMO. Floating your divs left should solve this problem....
I went with @CatPlusPlus's suggestion: Calculating the necessary values in a view and passing the template a very long string (raw) which contains the entire CSS. In the template, I...
Here is a way to do this without using AbsoluteLayout private void helloPopUp() { Window subWindow = new Window("Pop Up"); VerticalLayout subContent = new VerticalLayout(); subContent.setMargin(true); Label text = new...