I'm trying to get the horizontal grey lines to sit in front of the red background but behind the blue buttons. I've tried using z-index but I think it fails because the nested divs need to be placed in front of a div outside their containers.
Any help would be appreciated
http://jsfiddle.net/LZxxB/1/
<div data-role="page">
<div data-role="header">
<h1>Page Title</h1>
</div>
<!-- /header -->
<div role="main" class="ui-content" id="contentDiv">
<div class="fretboardWrapper">
<div class="strings">
<div class="string" id="stringHighE"></div>
<div class="string" id="stringB"></div>
<div class="string" id="stringG"></div>
<div class="string" id="stringD"></div>
<div class="string" id="stringA"></div>
<div class="string" id="stringLowE"></div>
</div>
<div class="stringTitle">
<div class="noteClickArea stringTitleContainerE1">
<div class="round-button" id="noteHigh0"> <span class="note">E</span>
</div>
</div>
<div class="noteClickArea stringTitleContainerB">
<div class="round-button" id="noteB0"> <span class="note">B</span>
</div>
</div>
<div class="noteClickArea stringTitleContainerG">
<div class="round-button" id="noteG0"> <span class="note">G</span>
</div>
</div>
<div class="noteClickArea stringTitleContainerD">
<div class="round-button" id="noteD0"> <span class="note">D</span>
</div>
</div>
<div class="noteClickArea stringTitleContainerA">
<div class="round-button" id="noteA0"> <span class="note">A</span>
</div>
</div>
<div class="noteClickArea stringTitleContainerE2">
<div class="round-button" id="noteLowE0"> <span class="note">E</span>
</div>
</div>
</div>
<div class="stringTitle">
<div class="noteClickArea stringTitleContainerE1">
<div class="round-button" id="noteHigh0"> <span class="note">E</span>
</div>
</div>
<div class="noteClickArea stringTitleContainerB">
<div class="round-button" id="noteB0"> <span class="note">B</span>
</div>
</div>
<div class="noteClickArea stringTitleContainerG">
<div class="round-button" id="noteG0"> <span class="note">G</span>
</div>
</div>
<div class="noteClickArea stringTitleContainerD">
<div class="round-button" id="noteD0"> <span class="note">D</span>
</div>
</div>
<div class="noteClickArea stringTitleContainerA">
<div class="round-button" id="noteA0"> <span class="note">A</span>
</div>
</div>
<div class="noteClickArea stringTitleContainerE2">
<div class="round-button" id="noteLowE0"> <span class="note">E</span>
</div>
</div>
</div>
</div>
</div>
<div data-role="footer">
<h4>Page Footer</h4>
</div>
<!-- /footer -->
</div>
<!-- /page -->
You were right to use z-index. But z-index only works for elements with position: relative, absolute or fixed.
I've set:
.string {
position: relative;
z-index: 2;
}
.round-button {
position: relative;
z-index: 3;
}
And removed the z-index from .stringTitle.
And it works
http://jsfiddle.net/LZxxB/2/
try this:
add position and z-index here:
.noteClickArea {
height:16.66%;
z-index:2;
position:relative;
}
and remove z-index here:
.stringTitle {
z-index:1; // REMOVE IT
}
see results here: http://jsfiddle.net/LZxxB/4/
My advice is to not touch z-indexing; Use html's implicit layer indexing;
I believe it behaves such that the first child element is topmost and the last element is bottom most, then leverage nesting. (I could have it backwards, it might be that the last element is rendered topmost)
This works best for be when using any sort of positioning, as the position can be specified independent of any z indexing, and element order can be manipulated by javascript if need be. (Assuming you anticipate using JavaScript at all)
Related
I have this html structure :
<div class="wrapper2">
<div class="previewContainer2">
<div id="previewGroup">
<div id="filePreview">
<div id="icon">
<div id="whiteSheet"/>
<div id="extension">EXT</div>
</div>
</div>
<img id="thumbnail" src="assets/indesign.svg" />
<div id="fileName">aaa</div>
</div>
</div>
<div class="metadataContainer2">
</div>
</div>
But then once loaded in electron, the last div (.metadataContainer2) is moved inside the .previewContainer2 div :\
<div class="wrapper2">
<div class="previewContainer2">
<div id="previewGroup">
<div id="filePreview">
<div id="icon">
<div id="whiteSheet">
<div id="extension">EXT</div>
</div>
</div>
<img id="thumbnail" src="assets/indesign.svg">
<div id="fileName">aaa</div>
</div>
</div>
<div class="metadataContainer2">
<p>ncndnlkcd</p>
</div>
</div>
</div>
Did I do something wrong ?
If you follow the HTML5 rules a div tag can not be self closed. Check more on this site
So modify your original code line#6 to mentioned below.
<div id="whiteSheet"></div>
I am trying to figure out how to position a header text behind a button and when I change the z-index and the top and left attributes it doesn't change as expected. The end goal is to position that header anywhere within the col I created for the button. When I change the top and left values the text doesn't move at all.
h1{
position:relative;
top:0;
left:0;
width:0px;
height:0px;
z-index:0;
}
#home_nav {
background-color: #5680E9;
}
a{
color:#ffffff;
}
<div class="container-fluid" id="home_nav">
<div class="row">
<div class="col">
<!--<div style="position:relative;">
<img src="/STEMuli_Website/img/pen.png" alt="Pen" style="width:40%;position:absolute; left:-20px; bottom:-100px"></div>-->
<div class="col">
<h1>Help?</h1>
</div>
<div class="col">
<button type="button" class="btn btn-link" data-toggle="modal" data-target="#exampleModal"><div class="display-2 text-right ">Create
</div>
</button>
</div>
</div>
<div class="w-100">
<div class="col">
<div class="display-2">
Explore
</div>
</div>
</div>
<div class="w-100">
<div class="col">
<div class="display-2">Your Library
</div>
</div>
</div>
<!--RSS feed here-->
<div class="col-8">
<div class="feedgrabbr_widget" id="fgid_15f3fc7e5ddb0c39637a55949">
</div>
<script>
if (typeof(fg_widgets) === "undefined") fg_widgets = new Array();
fg_widgets.push("fgid_15f3fc7e5ddb0c39637a55949");
</script>
<script async src="https://www.feedgrabbr.com/widget/fgwidget.js"></script>
</div>
</div>
</div>
add a class to the element.
.myfunbutton{z-index:10;position:relative;}
<div class="col myfunbutton ">
<button t
might be better ways...
For total control, change relative to absolute in your h1 .
I'm trying to make the entire content inside the <a> tag clickable but only the text is right now.
Here a CodePen: http://codepen.io/francobermudez/pen/dvBpNw?editors=1100
HTML:
<section id="ultimos-eventos">
<div class="eventos-wrap">
<a href="#">
<div class="evento">
<div class="evento-fecha">
<div class="evento-dia">20</div>
<div class="evento-mes">MAR</div>
</div>
<div class="evento-info">
<div class="evento-titulo">This is my title</div>
<div class="evento-subtitulo">
<div class="evento-direccion"><div></div>This is my subtitle</div>
<a class="btn-evento btn-azul" href="#">Detalles</a>
</div>
</div>
</div>
</a>
</div>
</section>
You have a link inside a link (The "Detalles" text) - that cannot work. Delete the inner link (i.e. convert it to a regular text div or p tag) and you'll be able to click the whole container.
<section id="ultimos-eventos">
<div class="eventos-wrap">
<a href="#">
<div class="evento">
<div class="evento-fecha">
<div class="evento-dia">20</div>
<div class="evento-mes">MAR</div>
</div>
<div class="evento-info">
<div class="evento-titulo">This is my title</div>
<div class="evento-subtitulo">
<div class="evento-direccion"><div></div>This is my subtitle</div>
<div>Detalles</div>
</div>
</div>
</div>
</a>
</div>
</section>
http://codepen.io/anon/pen/GWbNjN?editors=1100
I need to make image positioned like on below picture:
I have code:
<footer>
<div class="stopka1">
<div class="container">
....................
</p>
</div>
</div>
</footer>
<div class="container">
<div class="row" style="padding-right:0; padding-left:0;padding-top:30px;padding-bottom:20px;">
<div class="col-md-6">
<div class="row">
<div class="col-xs-6"><img src="phone.png" style="vertical-align:middle !important;"> <span style="font-weight:lighter;color:rgb(10, 55, 110);font-size: 28px; vertical-align:middle !important;">22 213 18 31</span></div>
<div class="col-xs-6"><button class="col-cs-12 przycisk-pytanie" style="font-weight: bold;margin-top:0;">Zadaj pytanie</button></div>
</div>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-xs-2"><img src="women.png" style=""></div>
<div class="col-xs-5">.. price ..</div>
<div class="col-xs-5"><button class="przycisk-rezerwuj-big" style="font-weight: bold;height:35px;">Rezerwuj teraz</button></div>
</div>
</div>
</div>
</div>
Have someone any idea how to get this effect? I have no idea how to force it to cover higher div.
You can do one of two options:
OPTION 1
img {margin-top:-20px;}
OPTION 2
img {position:relative; top:-20px;}
I have this html
<div class="row">
<div class="col-md-6" id="temp-box" >
<img id="weather-icon" src='Icons/sunny.png'></img>
<span id="temperature">50F</span>
</div>
<div class="col-md-6" > <div class="text-center" id="coodrs-title" ><span>Current Location</span></div>
<div class="position">
You Current Latitude Is: <span id="lati"></span><br/>
You Current Longitude Is: <span id="lngi"></span>
</div>
</div>
</div>
and i want the img with id #weather-icon be placed above the element with id #temperature, but both of them be inside the same row. How can i do this?
Ankit Agarwal gave me the best solution. Boootstrap's clear class!!!
Better solution is to use .clear bootstrap class. It willl work perfectly
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="col-md-6" id="temp-box" >
<img id="weather-icon" src='Icons/sunny.png'></img>
<div class="clear"></div>
<span id="temperature">50F</span>
</div>
<div class="col-md-6" > <div class="text-center" id="coodrs-title" ><span>Current Location</span></div>
<div class="position">
You Current Latitude Is: <span id="lati"></span><br/>
You Current Longitude Is: <span id="lngi"></span>
</div>
</div>
</div>
You could nest rows, like so:
<div class="row">
<div class="col-md-6" id="temp-box">
<div class="row">
<img id="weather-icon" src=''>IMAGE</img>
</div>
<div class="row"><span id="temperature">50F</span>
</div>
</div>
</div>
I'm not sure if this is the best way to to this, but it works.
Try setting:
#weather-icon {
display: block;
}
Currently you have an img & a span next to each other, which are both creating inline boxes. One way to force your image to have a line of its own is to set it to a block box element. At least that's my understanding of how it works.
Codepen:
http://codepen.io/anon/pen/pjzBRv
View code:
<div class="row">
<div class="col-md-6" id="temp-box" >
<img id="weather-icon" src='Icons/sunny.png'></img><br>
<span id="temperature">50F</span>
</div>
<div class="col-md-6" >
<div class="text-center" id="coodrs-title" ><span>Current Location</span></div> <div class="position"> You Current Latitude Is: <span id="lati"></span><br/> You Current Longitude Is: <span id="lngi">
</span>
</div>
</div>
</div>
In the code next "img" there is "br".