Show tool tip relative with parent element using CSS - css

I need help to show the tool tip relatively with parent element. Refer screen 1 it's show the description is perfect screen 1. But screen 2 Screen 2 when i scroll the section description show the same place but i need relative
<div class="item" data-key="15" data-value="244937">
<input class="option" id="treemultiselect-0-15" type="checkbox">
<span class="description">
<label class="" for="treemultiselect-0-15">Ashram</label>
</span>
<div class="temp-description-popup" style="position: absolute;">
No. & Listing of <b>Ashrams</b><br>
</div>
</div>

I think you're looking for something like this, right?
It's better you create a snippet & re-create your issue, so everyone can catch the idea & help you out.
The problem is that you set the element position: absolute, so it just keep the position based on its relative parent. Scrolling won't move it.
This example will help you better in understanding how position works https://codepen.io/AlHakem/pen/YayxBo
.scroller {
max-height: 150px;
overflow-y: scroll;
height: 150px;
float: left;
width: 200px;
}
.item {
position: relative;
}
.temp-description-popup {
visibility: hidden;
height: 0px;
}
.item:hover>.temp-description-popup {
visibility: visible;
height: auto;
padding: 4px;
background-color: #f1f1f1;
border-radius: 4px;
position: absolute;
top: 25px;
z-indeX: 2;
}
<div class="scroller">
<div class="item" data-key="15" data-value="244937">
<input class="option" id="treemultiselect-0-15" type="checkbox">
<span class="description">
<label class="" for="treemultiselect-0-15">Ashram</label>
</span>
<div class="temp-description-popup">
No. & Listing of <b>Ashrams</b><br>
</div>
</div>
<div class="item" data-key="15" data-value="244937">
<input class="option" id="treemultiselect-0-15" type="checkbox">
<span class="description">
<label class="" for="treemultiselect-0-15">Ashram</label>
</span>
<div class="temp-description-popup">
No. & Listing of <b>Ashrams</b><br>
</div>
</div>
<div class="item" data-key="15" data-value="244937">
<input class="option" id="treemultiselect-0-15" type="checkbox">
<span class="description">
<label class="" for="treemultiselect-0-15">Ashram</label>
</span>
<div class="temp-description-popup">
No. & Listing of <b>Ashrams</b><br>
</div>
</div>
<div class="item" data-key="15" data-value="244937">
<input class="option" id="treemultiselect-0-15" type="checkbox">
<span class="description">
<label class="" for="treemultiselect-0-15">Ashram</label>
</span>
<div class="temp-description-popup">
No. & Listing of <b>Ashrams</b><br>
</div>
</div>
<div class="item" data-key="15" data-value="244937">
<input class="option" id="treemultiselect-0-15" type="checkbox">
<span class="description">
<label class="" for="treemultiselect-0-15">Ashram</label>
</span>
<div class="temp-description-popup">
No. & Listing of <b>Ashrams</b><br>
</div>
</div>
<div class="item" data-key="15" data-value="244937">
<input class="option" id="treemultiselect-0-15" type="checkbox">
<span class="description">
<label class="" for="treemultiselect-0-15">Ashram</label>
</span>
<div class="temp-description-popup">
No. & Listing of <b>Ashrams</b><br>
</div>
</div>
</div>

Related

unwanted line feed between <label/> and <a/>

I have markup that puts anchors (for help icons) right after <label/> elements. If the label and icon would fix on one line, everything works how I want. However, if the label causes the text to wrap (due to length), then the icon creates a line feed and renders itself on a new line. I want the icon to simply appear 'after' the label on the same line no matter how many lines the label takes.
This is the result of the rendering (in case screen sizes aren't right - note, I don't know why Font Awesome isn't working in the fiddle, but you can still see the issue):
CSS
.row {
background: #f8f9fa;
margin-top: 20px;
}
.col {
border: solid 1px #6c757d;
padding: 10px;
}
HTML
<div class="container">
<div class="row">
<div class="col">
<label class="control-label liMedicare" for="iMedicare">I enrolled in Medicare in 2019</label>
<a class="vhiMedicare" style="" role="button" tabindex="0">
<span class="fal fa-question-circle"></span>
</a>
</div>
<div class="col">
<label class="control-label liMedicare" for="iMedicare">I enrolled in Medicare in 2019 with longer text so that it wraps</label>
<a class="vhiMedicare" style="" role="button" tabindex="0">
<span class="fal fa-question-circle"></span>
</a>
</div>
<div class="col">
3 of 3
</div>
</div>
</div>
Here is the fiddle: https://jsfiddle.net/8x2na97d/
Add the anchor tags inside label.
<label class="control-label liMedicare" for="iMedicare">I enrolled in Medicare in 2019
<a class="vhiMedicare" style="" role="button" tabindex="0">
<span class="fal fa-question-circle"></span>
</a>
</label>
Solution : https://jsfiddle.net/hqx5wjop/1/
It happens because label is displayed as an inline-block and anchor tag is displayed as inline
You can also solve it by adding the style
display: inline;
to label tag
Set this CSS:
label{
display: inline;
}
Try This code label{display:inline;}
.row {
background: #f8f9fa;
margin-top: 20px;
}
.col {
border: solid 1px #6c757d;
padding: 10px;
}
label{
display:inline;
}
<!--
Bootstrap docs: https://getbootstrap.com/docs
-->
<div class="container">
<div class="row">
<div class="col">
<label class="control-label liMedicare" for="iMedicare">I enrolled in Medicare in 2019 ffddff</label>
<a class="vhiMedicare" style="" role="button" tabindex="0">
<span class="fal fa-question-circle"></span>
</a>
</div>
<div class="col">
<label class="control-label liMedicare" for="iMedicare">I enrolled in Medicare in 2019 with longer text so that it wraps</label>
<a class="vhiMedicare" style="" role="button" tabindex="0">
<span class="fal fa-question-circle"></span>
</a>
</div>
<div class="col">
3 of 3
</div>
</div>
</div>
I think this code will help you for label and fa icon in same line,
<style>
.row {
background: #f8f9fa;
margin-top: 20px;
}
.col {
border: solid 0px #6c757d;
padding: 10px;
}
</style>
<body>
<div class="container">
<div class="row">
<div class="col">
<label class="control-label liMedicare" for="iMedicare">I enrolled in Medicare in 2019
<a class="vhiMedicare" style="" role="button" tabindex="0">
<span class="fal fa-question-circle"></span>
</a></label>
</div>
<div class="col">
<label class="control-label liMedicare" for="iMedicare">I enrolled in Medicare in 2019 with longer text so that it wraps
<a class="vhiMedicare" style="" role="button" tabindex="0">
<span class="fal fa-question-circle"></span>
</a> </label>
</div>
<div class="col">
3 of 3
</div>
</div>
</div>
</body>

My Last Element in the div Overflows so Only Half of the Element is Visible

I'm preparing my site for mobile browsers, so on Chrome Dev Tools i've tested on 320 x 568 size and i've encountered this problem.
My button element is on the bottom of the div, but half of the button is visible, other half is not.
Screenshot on the situation
I've tried to style the background (background-size etc) but the changes did not solve the issue.
What's the basic documentation / suggestion to overcome this problem?
Parent Div
<div class="view" id="activeSubstance" data-spy="activeSubstance" data-target="#activeSubstance" style="background-image: url('img/calculate_02.jpg'); background-repeat: no-repeat; background-size: cover; background-position: center center;"></div>
The Child
<div class="row text-center align-items-center mt-3">
<div class="col" id="calculate">
<button type="button" class="btn btn-cyan btn-lg disabled" id="calcButton">Hesaplayalım</button>
</div>
</div>
Full Code
<div class="view" id="activeSubstance" data-spy="activeSubstance" data-target="#activeSubstance" style="background-image: url('img/calculate_02.jpg'); background-repeat: no-repeat; background-size: cover; background-position: center center;">
<!-- Mask & flexbox options-->
<div class="mask rgba-stylish-light align-items-center flex-center">
<!-- Content -->
<div class="container">
<div class="row mt-3">
<!--Dropdown primary-->
<div class="col mt-2">
<!--Dropdown primary-->
<div class="dropdown">
<!--Trigger-->
<a class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false" style="display: block">Etken Madde Seçimi</a>
<!--Menu-->
<div class="dropdown-menu dropdown-primary" id="substanceList">
<a class="dropdown-item">Daptomisin - <small>Cubicin</small></a>
<a class="dropdown-item">Ertapenem sodyum - <small>İnvanz</small></a>
<a class="dropdown-item">Flukonazol - <small>Lumen EF</small></a>
<a class="dropdown-item">İmipenem / Silastatin sodyum - <small>Tienam</small></a>
<a class="dropdown-item">Kolistimetat sodyum - <small>Colimycin</small></a>
<a class="dropdown-item">Levofloksasin - <small>Tavanic</small></a>
<a class="dropdown-item">Linezolit - <small>Zyvoxid</small></a>
<a class="dropdown-item">Meropenem trihidrat - <small>Meronem</small></a>
<a class="dropdown-item">Metronidazol - <small>Metronidazol</small></a>
<a class="dropdown-item">Moksifloksasin hidroklorür - <small>Avelox</small></a>
<a class="dropdown-item">Piperasilin sodyum / Tazobaktam sodyum - <small>Tazocin EF</small></a>
<a class="dropdown-item">Sefoperazon sodyum / Sulbaktam sodyum - <small>Sulperazon</small></a>
<a class="dropdown-item">Siprofloksasin laktat - <small>Ciproktan</small></a>
<a class="dropdown-item">Teikoplanin - <small>Targocid</small></a>
<a class="dropdown-item">Tigesiklin - <small>Tygacil</small></a>
<a class="dropdown-item">Vankomisin hidroklorür - <small>Vancotek</small></a>
</div>
</div>
</div>
<!--/Dropdown primary-->
<!--Dropdown primary-->
<div class="col mt-2">
<!--Dropdown primary-->
<div class="dropdown">
<!--Trigger-->
<a class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false" style="display: block">Cockcroft-Gault Denklemi</a>
<!--Menu-->
<div class="dropdown-menu dropdown-info" id="methodlist">
<a class="dropdown-item2" id="willDisable">Cockcroft-Gault Denklemi</a>
<a class="dropdown-item2" id="willDisable2">e-GFR Hesaplayıcısı</a>
</div>
</div>
</div>
<!--/Dropdown primary-->
</div>
<div class="row mt-3">
<div class="col" style="display:none" id="notNeeded">
<p class="note note-info wow fadeIn" id="nonDiyaText">Bu etken madde için böbrek yetmezliği durumunda doz ayarlaması gerekmemektedir.</p>
</div>
</div>
<div class="row text-center align-items-center" id="cockgaulty">
<div class="col-6 col-lg-2">
<select class="browser-default custom-select" id="gender1">
<option selected>Cinsiyet</option>
<option value="1">Erkek</option>
<option value="2">Kadın</option>
</select>
</div>
<div class="col-6 col-lg-2 md-form input-group mb-3">
<input type="number" id="age1" class="form-control" placeholder="Yaş" aria-label="Yaş" aria-describedby="material-addon1" step='1' autocomplete="off" min="0">
</div>
<div class="col-6 col-lg-2 md-form input-group mb-3">
<input type="number" id="srcr1" class="form-control" placeholder="Serum kreatinini" aria-label="Serum kreatinini" aria-describedby="material-addon1" step='0.01' autocomplete="off" min="0">
</div>
<div class="col-6 col-lg-2">
<select class="browser-default custom-select" id="crunit1">
<option selected value="1">mg/dL</option>
<option value="2">‎µmol/L</option>
</select>
</div>
<div class="col-6 col-lg-2 md-form input-group mb-3">
<input type="number" id="weight" class="form-control" placeholder="Ağırlık" aria-label="Ağırlık" aria-describedby="material-addon1" step='0.5' autocomplete="off" min="0">
</div>
<div class="col-6 col-lg-2 custom-control custom-checkbox mt-3" id="diya1" style="padding-left: 2.5rem;">
<input type="checkbox" class="custom-control-input" id="diyaliz1">
<label class="custom-control-label" id="dia1" for="diyaliz1">Hemodiyaliz Alıyor</label>
</div>
</div>
<div class="row text-center align-items-center" style="display:none" id="egfry">
<div class="col-6 col-lg-2">
<select class="browser-default custom-select" id="gender2">
<option selected>Cinsiyet</option>
<option value="1">Erkek</option>
<option value="2">Kadın</option>
</select>
</div>
<div class="col-6 col-lg-1 md-form input-group mb-3">
<input type="number" id="age2" class="form-control" placeholder="Yaş" aria-label="Yaş" aria-describedby="material-addon1" step='1' autocomplete="off" min="0">
</div>
<div class="col-6 col-lg-2 md-form input-group mb-3">
<input type="number" id="srcr2" class="form-control" placeholder="Serum kreatinini" aria-label="Serum kreatinini" aria-describedby="material-addon1" step='0.01' autocomplete="off" min="0">
</div>
<div class="col-6 col-lg-1">
<select class="browser-default custom-select" id="crunit2">
<option selected value="1">mg/dL</option>
<option value="2">‎µmol/L</option>
</select>
</div>
<div class="col-6 col-lg-1 md-form input-group mb-3">
<input type="number" id="nitrog" class="form-control" placeholder="BUN" aria-label="BUN" aria-describedby="material-addon1" step='0.01' autocomplete="off" min="0">
</div>
<div class="col-6 col-lg-2 md-form input-group mb-3">
<input type="number" id="albumin" class="form-control" placeholder="Albumin" aria-label="Albumin" aria-describedby="material-addon1" step='0.01' autocomplete="off" min="0">
</div>
<div class="col-6 col-lg-1 custom-control custom-checkbox mt-2">
<input type="checkbox" class="custom-control-input" id="black">
<label class="custom-control-label" for="black">Siyahi</label>
</div>
<div class="col-6 col-lg-2 custom-control custom-checkbox mt-2" id="diya2">
<input type="checkbox" class="custom-control-input" id="diyaliz2">
<label class="custom-control-label" id="dia2" for="diyaliz2">Hemodiyaliz Alıyor</label>
</div>
</div>
<div class="row mt-3">
<div class="col" id="infoDiv">
<p class="note note-info wow fadeIn" id="infoText"><strong>Cockcroft-Gault Denklemi </strong>ile hesaplama yaparken cinsiyet, yaş, ağırlık ve serum kreatinini değerlerini girmeniz gerekir.</p>
</div>
</div>
<div class="row text-center align-items-center mt-3">
<div class="col" id="calculate">
<button type="button" class="btn btn-cyan btn-lg disabled" id="calcButton">Hesaplayalım</button>
</div>
</div>
<!-- /Content -->
</div>
</div>
Problem Causing "view" class CSS
.view {
position: relative;
overflow: hidden;
cursor: default; }
.view .mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
width: 100%;
height: 100%;
background-attachment: fixed; }
.view img, .view video {
position: relative;
display: block; }
.view video.video-intro {
z-index: -100;
top: 50%;
left: 50%;
-webkit-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
-webkit-transition: 1s opacity;
-o-transition: 1s opacity;
transition: 1s opacity;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto; }
PS: As you can see in the screenshot, "The end of the div" i've mentioned is not the end of the page, instead another DIV starts. But my button overflowed from the div above and only half of it is visible
close the div class="view" may be your problem resolved

Z-index not working on div on fixed position header

I have a page using a masterpage in asp.net 4.0. My masterpage has header which has a search box. Header has css position fixed and have z-index 10.
I am trying to create a search instruction which will open when user types anything. my instruction box do not show as floatig over header instead it opens inside header and expands it. Here are my css and html
header {
width:100%;
display:inline-block;
background-color:#ef4023;
position:fixed;
z-index:10;
}
header #Guide {
width: 100%;
z-index: 5;
margin-right: -1px;
position:relative;
background: #eee;
border: 1px solid #ccc;
}
<header>
<div class="col-lg-4 col-md-4 col-sm-2 col-xs-4">
<div class="logo">
<img src="images/logo.png" alt="logo" class="img-responsive" />
</div>
</div>
<div class="col-lg-8 col-md-8 col-sm-10 col-xs-8">
<div class="col-md-6">
<!--SearchBarStart-->
<div ng-controller="MyCtrl">
<form>
<h3>Search Here </h3>
<input type="text" class="form-control" id="SearchKeyword" ng-model="searchText" required="required" />
<div class="list-group" id="Guide" ng-show="showLinks">
<a class="list-group-item" href="" ng-click="SearchType(0,true,'KeyWord', 1)">
<div class="input-group">
<span class="fa fa-suitcase"></span><span style="padding-left: 20px">instruction goes here</span>
</div>
</a>
</div>
</form>
</div>
</div>
</div>
</header>
You have to use position: fixed also on the instruction box, with according position settings. (relative will put it into the document flow, thereby taking up space, and absolute won't work since you don't have a relative parent for it.)
header {
width: 100%;
display: inline-block;
background-color: #ef4023;
position: fixed;
z-index: 10;
}
header #Guide {
width: 100%;
z-index: 15;
margin-right: -1px;
position: fixed;
top: 110px;
left: 0px;
background: #eee;
border: 1px solid #ccc;
}
<header>
<div class="col-lg-4 col-md-4 col-sm-2 col-xs-4">
<div class="logo">
<img src="images/logo.png" alt="logo" class="img-responsive" />
</div>
</div>
<div class="col-lg-8 col-md-8 col-sm-10 col-xs-8">
<div class="col-md-6">
<!--SearchBarStart-->
<div ng-controller="MyCtrl">
<form>
<h3>Search Here </h3>
<input type="text" class="form-control" id="SearchKeyword" ng-model="searchText" required="required" />
<div class="list-group" id="Guide" ng-show="showLinks">
<a class="list-group-item" href="" ng-click="SearchType(0,true,'KeyWord', 1)">
<div class="input-group">
<span class="fa fa-suitcase"></span><span style="padding-left: 20px">instruction goes here</span>
</div>
</a>
</div>
</form>
</div>
</div>
</div>
</header>`

How do I get this button to go beside the email field

How do I get the subscribe button to go beside the email field of the form.. and the hover doesn't seem to be working on the subscribe button
using bootstrap and HTML5 and CSS
<form class="subscribe_form">
<div class="subscrive_group wow fadeInUp">
<input class="form-control subscribe_mail" type="email" placeholder="Enter your email address">
<input class="btn-form" type="submit" value="Subscribe">
</div>
</form>
CSS
subscribe_form {
border: 1px solid #DDDDDD;
color: #CCCCC6;
font-family: 'Roboto', sans-serif;
font-size: 16px;
margin-top: 0;
outline: medium none;
width: 75%;
}
.subscribe_form .btn-form {
margin: 10px;
}
.btn-form {
color: #00bfff;
padding: 10px 30px;
font-weight: 500;
text-decoration: none;
border-radius: 200px;
transition: background-color 0.2s, border 0.2s, color 0.2s;
border: 1px solid #00bfff;
background-color: #fff;
letter-spacing: .5px;
font-size: 16px;
}
.btn-form:hover,
.btn-form:active {
border: 1px solid #00bfff;
background-color: #fff;
color: #00bfff;}
heres what happened when I tried this below (image attached)
Here is the rest of the code for that section
<section class="works service-page">
<div class="container">
<h2 class="subtitle wow fadeInUp animated" data-wow-delay=".3s" data-wow-duration="500ms">TEXT </h2>
<p class="subtitle-des wow fadeInUp animated" data-wow-delay=".5s" data-wow-duration="500ms">
TEXT
</p>
<div class="row">
<div class="col-sm-4 ">
<figure class="wow fadeInLeft animated portfolio-item" data-wow-duration="500ms" data-wow-delay="0ms">
<figcaption>
<h2>
<a href="#" class="figma">
text</a> <span class="par-text-one">text</span>
</h2>
<p class="para">
text
</p>
</figcaption>
<div class="img-wrapper">
<img src="images/" class="img-responsive" alt="this is a title" >
<div class="overlay">
<div class="buttons">
<a target="_blank" href="">Discover</a>
</div>
</div>
</div>
<figcaption>
<p class="para">text
<br>
text
</p>
</figcaption>
</figure>
</div>
<div class="col-sm-4 ">
<figure class="wow fadeInLeft animated portfolio-item" data-wow-duration="500ms" data-wow-delay="0ms">
<figcaption>
<h2>
<a href="#" class="figma">
text </a> <span class="par-text-one">text </span>
</h2>
<p class="para">text
</p>
</figcaption>
<div class="img-wrapper">
<img src="images/.jpg" class="img-responsive" alt="this is a title" >
<div class="overlay">
<div class="buttons">
<a target="_blank" href="">Discover</a>
</div>
</div>
</div>
<figcaption>
<p class="para">text
<br>text
</p>
</figcaption>
</figure>
</div>
<div class="col-sm-4 boxed">
<h2> More Products Coming Soon! </h2>
<p class="para-form">
text
</p>
<p class="para-blue">text
</p>
<div class="container">
<form class="subscribe_form">
<div class="subscrive_group wow fadeInUp row col-sm-12">
<div class="col-sm-6">
<input class="form-control subscribe_mail" type="email" placeholder="Enter your email address">
</div>
<div class="col-sm-6">
<input class="btn-form" type="submit" value="Subscribe">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
You can add the form-inline class on your <form> tag.
http://getbootstrap.com/css/#forms-inline.
<form class="subscribe_form form-inline">
<div class="subscrive_group wow fadeInUp">
<input class="form-control subscribe_mail" type="email" placeholder="Enter your email address">
<input class="btn-form" type="submit" value="Subscribe">
</div>
</form>
try this:
<form class="subscribe_form">
<div class="subscrive_group wow fadeInUp row col-sm-12">
<div class="col-sm-6">
<input class="form-control subscribe_mail" type="email" placeholder="Enter your email address">
</div>
<div class="col-sm-6">
<input class="btn-form" type="submit" value="Subscribe">
</div>
</div>
</form>

How to put text above input box?

https://jsfiddle.net/pqrbm0o0/
Currently, name/phone #/message/email is on the left side of the box
how can i align it on the top left (not the top center)?
<div class="col-sm-6">
<h4><strong>Your Contact Information</strong></h4>
<span style="color:#cc0000; margin-left:25px">• </span>Required fields.<br/>
<br/>
<div class="contact">
<div class="block">
<label>Name:</label>
<input type="Name" style="width:250px;" />
<span style="color:#cc0000;">• </span> </div>
<div class="block">
<label>Phone Number:</label>
<input type="phone" style="width:250px;"/>
<span style="color:#cc0000;">• </span> </div>
<div class="block">
<label>Email:</label>
<input type="email" style="width:250px;"/>
<span style="color:#cc0000;">• </span> </div>
<div class="block">
<label>Message:</label>
<textarea name="Message" id="Message" style="width:350px;"></textarea>
<span style="color:#cc0000;">• </span>
</div>
</div>
In your CSS, apply the following styles:
.block label { display: block;
text-align: left;
}
This will allow it to be on its own line rather than inline and setting text align left should be fairly straightforward.
In case you don't know the difference between inline-block and block:
https://css-tricks.com/almanac/properties/d/display/

Resources