I am using Kendo Grid to display Grid view of data. I have a column with button that, when clicked, shows a list of options on top of the page and left to the button.
I am not using Kendo Popup or context menu, but just using ng-template with structural directive logic.
What i look for?
What i get?
This is my Kendo grid column:
<div style="position: relative">
<kendo-grid>
...
<kendo-grid-column title="SAMPLE">
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
<div class="context-dropdown-menu" *ngIf="showIndex === rowIndex && showDialog" style="position: absolute;">
<ul>
<li> <i class="fa fa-envelope"></i> Item2.1 </li>
<li> <i class="fa fa-envelope"></i> Item2.2 </li>
<li> <i class="fa fa-envelope"></i> Item2.3 </li>
</ul>
<div>
<button type="button" (click)="clicked(rowIndex)"> Click </button>
</ng-template>
</kendo-grid-column>
...
</kendo-grid>
</div>
Thanks in advance!
Replace below style in your stackblitz example it will work fine.
.context-dropdown-menu {
margin: 0 -10.75rem;
padding: 0px;
width: 170px;
z-index: 999999;
}
.context-dropdown-menu ul {
margin: 0px;
padding: 0px;
list-style: none;
background: #e4e4e4
}
.context-dropdown-menu ul li {
font-size: 13px;
padding: 7px 10px;
border-bottom: 1px solid #efefef;
color: #617189;
cursor: pointer;
}
.context-dropdown-menu ul li:hover {
background: #f5f5f5;
}
Related
I have a simple tag with fontawesome class.
<div class="bh-header-menu-ct bh-left">
<a href="javascript:void(0)" class="bh-menu-icon bh-circle bh-color-700 bh-ripple" (click)="onToggle()">
<i class="fa fa-align-center"></i>
</a>
</div>
.bh-header-menu-ct{
height: inherit;
line-height: 60px;
padding: 0 10px;
.bh-menu-icon{
padding: 10px;
}
}
On IE Its behaving bit wiered
Edit: Code indentation
I've been struggling for a correct alignemt between two icons and a small text but I cant manage to properly align them:
I need the text to be align with both icons, can someone give me a help; i've checked a very similar post but I couldn't make it work.
.icon-company-title {
margin-top: 30px;
}
.material-icons.md-18 {
color: $primary;
font-size: 40px;
line-height: 0!important;
}
.material-icons.edit {
color: $primary;
vertical-align: middle;
}
.business-icon {
display: inline-block;
vertical-align: bottom;
}
<div class="icon-company-title">
<div class="business-icon">
<i class="material-icons md-18">business</i>
</div>
<span class="company-card-title">{{ entity.name }}</span>
<button class="" mat-icon-button [matMenuTriggerFor]="menu">
<i class="material-icons edit">mode_edit</i>
</button>
</div>
I want to get the style like this:
With my code I achieved like this:
Here is my code:
<div>
<a class="appointments" data-ng-click="showPrev(index)">
<i class="icon-double-angle-left"></i>
</a>{{date}}
<a data-ng-click="showNext(index)">
<i class="icon-double-angle-right"></i>
</a>
<div>
<span class="appointments" data-ng-repeat="time in times"><br>
<span data-ng-click="showModal()">{{time}}</span></span>
</div>
</div>
Can anyone please suggest me help. Thanks!
hope this help you to go in right direction...
Check the CSS
.time > span {
background-color: #F2F2F2;
color: #2AAAC7;
display: block;
width: 100px;
padding: 5px 25px;
margin: -5px;
text-align: center;
}
.date > i {
color: #2AAAC7;
}
<div>
<a class="appointments date" data-ng-click="showPrev(index)">
<i class="icon-double-angle-left"></i>
</a>
2017-06-29
<a data-ng-click="showNext(index)">
<i class="icon-double-angle-right"></i>
</a>
<div>
<span class="appointments time" data-ng-repeat="time in times"><br>
<span data-ng-click="showModal()">8:00 AM</span>
</span>
<span class="appointments time" data-ng-repeat="time in times"><br>
<span data-ng-click="showModal()">9:50 AM</span>
</span>
<span class="appointments time" data-ng-repeat="time in times"><br>
<span data-ng-click="showModal()">10:00 AM</span>
</span>
</div>
</div>
Use padding for the problem padding-top
using css then you can solve your problem.
<style>
table {
border-collapse: collapse;
width: 100%;
}
th, td {
text-align: left;
padding: 8px;
}
tr:nth-child(even){background-color: #f2f2f2}
</style>
[1] [https://www.w3schools.com/css/tryit.asp?filename=trycss_table_striped]
[1]: refer for more informtion
I am making something with ace editor. As part of this, I have a dropdown menu that allows theme selection. This is on a bar at the top, (which will eventually have more options). I know that, in order to position the bar at the very top, I need to use position:absolute in the CSS code. However, this breaks the dropdown, and it no longer actually drops down. To see what I mean, here is a fiddle. (To compare, removing position: absolute in the CSS for #navbar makes it work fine, but is not at the very top [most visible in a full window].)
Note: In the fiddle, I have removed everything not related to the navbar, such as the ace code.
Seems to work fine if you remove the max-height from .dropChoices, the bottom and overflow on #navbar
// The function changeTheme() is defined in the full code
function toggle(button) {
var dropList = button.nextElementSibling;
function isDropdown() {
return (" " + dropList.className + " ").indexOf(" dropChoices ") > -1;
}
while (!isDropdown) {
dropList = dropList.nextElementSibling;
}
dropList.classList.toggle("hidden");
window.onclick = function(e) {
if (!e.target.matches('.dropButton') && !e.target.matches('.dropChoices')) {
if (!dropList.classList.contains('hidden')) {
dropList.classList.add('hidden');
}
}
}
}
#navbar {
position: absolute;
top: 0;
left: 0;
right: 0;
background-color: dimgray;
}
.navOption {
font-size: 12px;
color: white;
padding: 1px 13px;
}
.dropButton {
box-sizing: border-box;
cursor: pointer;
font-size: 16px;
border: none;
color: white;
padding: 13px 16px;
background-color: inherit;
}
.navOption:hover, .navOption:active, .navOption:focus {
background-color: gray;
outline: none;
}
.dropChoices {
font-size: 16px;
overflow: auto;
display: block;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
z-index: 5;
max-height: calc(100vh - 50px);
}
.dropChoices p {
color: black;
outline: none;
padding: 12px 16px;
cursor: pointer;
margin: 0;
text-align: left;
}
.dropChoices p:hover, .dropChoices p:focus {
background-color: lightgray;
}
p.dropTitle {
cursor: initial;
}
p.dropTitle:hover {
background-color: #f9f9f9;
}
.hidden {
display: none;
}
<!-- This code is slightly shortened, and only contains the relevant things -->
<div id="navbar">
<button onclick="toggle(this)" class="dropButton navOption">Themes</button>
<div id="themesList" class="dropChoices hidden">
<p class="dropTitle"><b>Light</b></p>
<p tabindex="0" id="chrome" onclick="changeTheme(this.id)">Chrome</p>
<p tabindex="0" id="clouds" onclick="changeTheme(this.id)">Clouds</p>
<p tabindex="0" id="crimson_editor" onclick="changeTheme(this.id)">Crimson Editor</p>
<p tabindex="0" id="dawn" onclick="changeTheme(this.id)">Dawn</p>
<p tabindex="0" id="dreamweaver" onclick="changeTheme(this.id)">Dreamweaver</p>
<p tabindex="0" id="eclipse" onclick="changeTheme(this.id)">Eclipse</p>
<p tabindex="0" id="gitHub" onclick="changeTheme(this.id)">GitHub</p>
<p tabindex="0" id="iplastic" onclick="changeTheme(this.id)">IPlastic</p>
<p tabindex="0" id="solarized_light" onclick="changeTheme(this.id)">Solarized Light</p>
<p tabindex="0" id="textmate" onclick="changeTheme(this.id)">TextMate</p>
<p tabindex="0" id="tomorrow" onclick="changeTheme(this.id)">Tomorrow</p>
<p tabindex="0" id="xcode" onclick="changeTheme(this.id)">XCode</p>
<p tabindex="0" id="kuroir" onclick="changeTheme(this.id)">Kuroir</p>
<p tabindex="0" id="katzenmilch" onclick="changeTheme(this.id)">KatzenMilch</p>
<p tabindex="0" id="sqlserver" onclick="changeTheme(this.id)">SQL Server</p>
<p class="dropTitle"><b>Dark</b></p>
<p tabindex="0" id="ambiance" onclick="changeTheme(this.id)">Ambiance</p>
<p tabindex="0" id="chaos" onclick="changeTheme(this.id)">Chaos</p>
<p tabindex="0" id="clouds_midnight" onclick="changeTheme(this.id)">Clouds Midnight</p>
<p tabindex="0" id="cobalt" onclick="changeTheme(this.id)">Cobalt</p>
<p tabindex="0" id="gruvbox" onclick="changeTheme(this.id)">Gruvbox</p>
<p tabindex="0" id="idle_fingers" onclick="changeTheme(this.id)">idle Fingers</p>
<p tabindex="0" id="kr_theme" onclick="changeTheme(this.id)">krTheme</p>
<p tabindex="0" id="merbivore" onclick="changeTheme(this.id)">Merbivore</p>
<p tabindex="0" id="merbivore_soft" onclick="changeTheme(this.id)">Merbivore Soft</p>
<p tabindex="0" id="mono_industrial" onclick="changeTheme(this.id)">Mono Industrial</p>
<p tabindex="0" id="monokai" onclick="changeTheme(this.id)">Monokai</p>
<p tabindex="0" id="pastel_on_dark" onclick="changeTheme(this.id)">Pastel on dark</p>
<p tabindex="0" id="solarized_dark" onclick="changeTheme(this.id)">Solarized Dark</p>
<p tabindex="0" id="terminal" onclick="changeTheme(this.id)">Terminal</p>
<p tabindex="0" id="tomorrow_night" onclick="changeTheme(this.id)">Tomorrow Night</p>
<p tabindex="0" id="tomorrow_night_blue" onclick="changeTheme(this.id)">Tomorrow Night Blue</p>
<p tabindex="0" id="tomorrow_night_bright" onclick="changeTheme(this.id)">Tomorrow Night Bright</p>
<p tabindex="0" id="tomorrow_night_eighties" onclick="changeTheme(this.id)">Tomorrow Night 80s</p>
<p tabindex="0" id="twilight" onclick="changeTheme(this.id)">Twilight</p>
<p tabindex="0" id="vibrant_ink" onclick="changeTheme(this.id)">Vibrant Ink</p>
</div>
</div>
You have to make the drop down relative to the parent if its going to be in absolute position.
Set the parent position to relative, and then the dropdown will be positioned inside or within the parent tag.
Like Example:
<div style="position:relative;">
<div class="dropdown" style="position:absolute; top:0; left:0;">...</div>
</div>
I want to create a rounded button in BS3 (a perfect circle), with a single fontawesome(4.0) icon in the center.
So far, I have the following code:
HTML:
<i class="fa fa-user"></i>
What would the CSS markup be to make this button a perfect circle?
you can do something like adding a class to add border radius
HTML:
<i class="fa fa-user"></i>
CSS:
.btn-circle {
width: 30px;
height: 30px;
text-align: center;
padding: 6px 0;
font-size: 12px;
line-height: 1.42;
border-radius: 15px;
}
in case you wanted to change dimension you need to change the font size or padding accordingly
(Not cross-browser tested), but this is my answer:
.btn-circle {
width: 40px;
height: 40px;
line-height: 40px; /* adjust line height to align vertically*/
padding:0;
border-radius: 50%;
}
vertical center via the line-height property
padding becomes useless and must be reset
border-radius independant of the button size
Boostrap 3 has a component for exactly this. It's:
<span class="badge">100</span>
This is the best reference using font-awesome.
http://bootsnipp.com/snippets/featured/circle-button?
CSS:
.btn-circle { width: 30px; height: 30px; text-align: center;padding: 6px 0;font-size: 12px;line-height: 1.428571429;border-radius: 15px;}.btn-circle.btn-lg {width: 50px;height: 50px;padding: 10px 16px;font-size: 18px;line-height:1.33;border-radius: 25px;}
With Font Awesome ICONS, I used the following code to produce a round button/image with the color of your choice.
<code>
<span class="fa fa-circle fa-lg" style="color:#ff0000;"></span>
</code>
I had the same problem and came up with a very simple solution working for all (xs, sm, normal and lg) buttons more or less:
.btn-circle {
border-radius: 50%;
padding: 0.1em;
width:1.8em;
}
The difference between the btn-xs and -sm are only their padding. And this is not covered with this snippet. This snippet calculates the sizes based on the font-size only.
If you have downloaded these files locally then you can change following classes in bootstrap-social.css, just added border-radius: 50%;
.btn-social-icon.btn-lg{height:45px;width:45px;
padding-left:0;padding-right:0; border-radius: 50%; }
And here is teh HTML
<a class="btn btn-social-icon btn-lg btn-twitter" >
<i class="fa fa-twitter"></i>
</a>
<a class=" btn btn-social-icon btn-lg btn-facebook">
<i class="fa fa-facebook sbg-facebook"></i>
</a>
<a class="btn btn-social-icon btn-lg btn-google-plus">
<i class="fa fa-google-plus"></i>
</a>
It works smooth for me.
Use font-awesome stacked icons (alternative to bootstrap badges). Here are more examples: http://fontawesome.io/examples/
.no-border {
border: none;
background-color: white;
outline: none;
cursor: pointer;
}
.color-no-focus {
color: grey;
}
.hover:hover {
color: blue;
}
.white {
color: white;
}
<button type="button" (click)="doSomething()"
class="hover color-no-focus no-border fa-stack fa-lg">
<i class="color-focus fa fa-circle fa-stack-2x"></i>
<span class="white fa-stack-1x">1</span>
</button>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
To add a rounded border in any button the best way is to add the border-radius property. I belive this class is better because you can add-it at any button size. If you set the height and widht you will need to create a "rouding" class to each button size.
.btn-circle {
border-radius: 50%;
}
<button class='btn-circle'>Click Me!</button>
<button class='btn-circle'>?</button>