Ive got the following for the parent div:
#parent {
overflow: hidden;
}
And the following for the inner div which is a drop down div. When click to show, a part of the drop down which goes below the parent div, is not displayed (only half displayed).
#dropDown {
display: none;
position: absolute;
}
and here is my HTML code:
<div id='parent'>
<ul>
<li id="exportWrapper">
<button onclick="return false" id="triggerDropDown">trigger </button>
<div id="dropDown">
<span class="one"> link one</span><br>
<span class="two"> link two</span>
</div>
</li>
</ul>
</div>
I didn't see anything that called the #dropDown css. I changed the div#exportDivContent to div#dropDown and it hides the two . Is that you are trying to do?
<ul>
<li id="exportWrapper">
<button onclick="return false" id="triggerDropDown">trigger </button>
<div id="dropDown">
<span class="one"> link one</span><br>
<span class="two"> link two</span>
</div>
</li>
</ul>
Well, I think the problem here is you setting overflow: hidden to the parent div. So, at first there is no overflow and the button is displayed properly. Then, when you click on the button, the height of it increases since there is a drop down list and hence, it shows only half of the list.
Try removing overflow: hidden [Edit] : or this:
<button onclick="a_function()" id="triggerDropDown">trigger </button>
<div id="dropDown">
<span class="one"> link one</span><br>
<span class="two"> link two</span>
</div>
<script>
function a_function(){
document.getElementById("parent").style.height = "60px";
}
</script>
Related
I have a navigation that is horizontal. Under every choice I have a div that opens up on click. But the problem is that it binds it's position to the parent navigation button. I want every div that opens on the exact same spot. I want every child div that opens to open from the first element in the navigation bar.
So in this case i want the white open div to bind to "Nyheter" instead. I really can't solve it, I tried set a div element before the navigation that all div that opens binds to in css but it not seems to work.
<div class="Container">
<nav class="NavHorizontal Grid Grid--alignMiddle">
#Navigation.RenderNavigation("master/navigationDesignHeader.cshtml", navigationSettings)
</nav>
</div>
//NavigationDesignheader.cshtml under this line
var elementId = 1;
foreach (var node in nodes)
{
var idElement = "megaMenu" + elementId;
<div class="NavHorizontal-item Grid-cell u-sizeFit" id="#idElement">
<a class="Button Button--tab navigationHeaderLink u-pointer" onclick="toggleMenu('#elementId')">
#node.Name
</a>
#RenderMegaMenu(node.Nodes, node.Link, node.Name)
</div>
elementId++;
}
Megamenu:
<div>
<div id="megaMenuDropdown" class="Container megaMenuDropdown-content displayNone">
<div class="Grid Grid--withGutter">
<div class="Grid-cell u-sizefull u-mt-10">
#nodeName
<div class="megaMenuToggle-closeBars u-pointer" style="float:right">
<span class="megaMenuToggle-closeBar"></span>
<span class="megaMenuToggle-closeBar"></span>
</div>
</div>
</div>
<hr class="colorBlue" />
<div class="Grid Grid--withGutter">
<div class="Grid-cell u-size12of12 u-md-size6of12 u-lg-size6of12">
<ul>
#foreach (var node in firstColumn)
{
<li class="u-mb-10 linkHover">
<a class="userLink colorBlue" href="#node.Link">#node.Name</a>
</li>
}
</ul>
</div>
#if (moreThanTen)
{
<div class="Grid-cell u-size12of12 u-md-size6of12 u-lg-size6of12">
<ul>
#foreach (var node in secondColumn)
{
<li class="u-mb-10 linkHover">
<a class="userLink colorBlue" href="#node.Link">#node.Name</a>
</li>
}
</ul>
</div>
}
</div>
</div>
</div>
Any suggestions?
Here are two potential situations in my HTML:
<div class="ptb_sold">
<span class="ptb_one_line">Sold</span>
</div>
<div class="ptb_link_button">
<a class="ptb_link_button" target="_blank" href="https://test.html">Click to Register</a>
</div>
<div class="ptb_sold"></div>
<div class="ptb_link_button">
<a class="ptb_link_button" target="_blank" href="https://test.html">Click to Register</a>
</div>
My goal is to hide "ptb_link_button" in the first one, but allow the "ptb_link_button" div to display in the second example. Basically, if the item is sold, I do not want to display the "Register" button.
I initially thought this would work:
div.ptb_sold:empty+.ptb_link_button {
display: none;
}
<div class="ptb_sold">
<span class="ptb_one_line">Sold</span>
</div>
<div class="ptb_link_button">
<a class="ptb_link_button" target="_blank" href="https://test.html">Click to Register - Link one</a>
</div>
<div class="ptb_sold"></div>
<div class="ptb_link_button">
<a class="ptb_link_button" target="_blank" href="https://test.html">Click to Register - Link two</a>
</div>
But unfortunately it does not. Any other suggestions?
If I understood you correctly, then I think this would be the approach:
// Hides the button if sold
div.ptb_sold + .ptb_link_button a.ptb_link_button {
display: none;
}
// Show the button if not sold
div.ptb_sold:empty + .ptb_link_button a.ptb_link_button {
display: block;
}
Example - https://jsfiddle.net/4o1gvnjx/
Also, I would consider changing the class name of the container for the button to be something like 'ptb_link_button-container' to avoid confusion. That way, the CSS selector would be more streamlined.
So I'm making a website (suprise, suprise) and I have a button on the top of the page, and when I click it, it does nothing. I am wondering how to fix it.
The button
<button class="Learn-Link" href="#VideoSlide">Learn How
<div class="Learn-Triangle"></div>
</button>
And the part I want to travel to
<div class="Slide" id="VideoSlide">
<!--More code here, but not relevant-->
</div>
button doesn't have an href attribute you need to add an a tag inside your button
#VideoSlide{
position: relative;
top:1000px;
height: 100px;
background: pink
}
<button class="Learn-Link" >Learn How
<div class="Learn-Triangle"></div>
</button>
<div class="Slide" id="VideoSlide">
<!--More code here, but not relevant-->
</div>
You can trigger button by using javascript
Eg:-
<button type="button" onclick="alert('Hello world!')">Click Me!</button>
I have the following HTML definition.
(I'm using Knockout)
<ul data-bind="foreach: itemList">
<li>
<span data-bind="text: displayName"></span>
<span class="right" data-bind="text: measurement"></span>
<input type="checkbox" />
</li>
</ul>
I would like these to display aligned as the following
Item1 measurement1 Checkbox1
Item2 measurement2 Checkbox2
Item3 measurement3 Checkbox3
I would like this to be aligned the following way:
Column 1 is floated to the far left.
Column 3 (The input checkbox) is floated to the far right.
Column 2 is is on the far right, but to the left of Column3
I've tried working with DIVs and the float/display attributes.
I haven't been able to achieve the desired visual behavior.
How would I accomplish this?
float and text-align ?
li {
display:block;
text-align:right;
width:200px;/* whatever width you set here or in parent */
}
li :first-child {
float:left;
}
input {
vertical-align:middle;/* ? */
}
<ul data-bind="foreach: itemList">
<li>
<span data-bind="text: displayName">item</span>
<span class="right" data-bind="text: measurement">measure</span>
<input type="checkbox" />
</li>
</ul>
One option might be to use Bootstrap's grid system — you would be able to specify the proportional width of each column. Additionally, it becomes easier to handle its responsiveness to screensize.
In your case, you might use it like this:
<div class="container-fluid">
<ul data-bind="foreach: itemList">
<li>
<div class="row">
<div class="col-xs-6">
<span data-bind="text: displayName"></span>
</div>
<div class="col-xs-3">
<span class="right" data-bind="text: measurement"></span>
</div>
<div class="col-xs-3">
<input type="checkbox" />
</div>
</div>
</li>
</ul>
</div>
See more grid examples here.
--
If you are trying to present tabular data, you might also consider using HTML tables and specifying its percentage column width.
Might I recommend a flex-box? I put a growing spacer in to push the middle column over to the right. Modifying GCyrillus' answer:
li {
display: flex;
justify-content: space-between;
width: 90%;
/* whatever width you set here or in parent */
}
li .spacer {
flex-grow: 1;
}
<ul data-bind="foreach: itemList">
<li>
<span data-bind="text: displayName">item</span>
<span class="spacer"></span>
<span class="right" data-bind="text: measurement">measure</span>
<input type="checkbox" />
</li>
</ul>
I've a problem with anchor tags :/
I've got the following code:
<div name="divA">
<a name="A"> A</a>
</div>
<div name="divB" style="display: none;">
<a name="B"> B</a>
</div>
<div name="divHrefB">
B
</div>
My goal is that when i click on B (divHrefB) the application go to "divB" but since this element hidden it doesn't work.
Please note, that i don't want to show divB (i want a link to the place where div are... is that possible?
At this point, i'm thinking on generate dynamically the href value (in this case, i would generate the following div)
<div name="divHrefB">
B
</div>
Thanks a lot.
just don't apply display: none, just add this css for the hidden div.
<div name="divHrefB" style="height: 0px;width: 0px;overflow:hidden;">
B
</div>
You're missing the ending closing " comment.
try this guy:
style="display: none;"
you are missing " in style end
<div name="divA">
<a name="A"> A</a>
</div>
<div name="divB" style="display: none;">
<a name="B"> B</a>
</div>
<div name="divHrefB">
B
</div>