CSS styling for a Kendo TreeView - css

I've got some Bootstrap css styling issues on several Kendo TreeView widgets I'm rendering.
Basically, I have a wizard which the user will navigate through, and on one of the pages I'm display two Kendo TreeView widgets. The user will be able to drag items from the left "source" tree onto their own customized data tree.
Right now the datasource is the same, but that doesn't matter.
The important thing is that the sprite folder image on my left navbar tree is getting hidden every time I navigate to my wizard page which contains the dual treeviews.
I'd like to style of the TreeView so it doesn't interfere with another tree widget in my sidebar. The sprite folder icon is getting hidden in my sidebar tree once I click on the "+" icon which changes my page.
Here is the reportmaint.html page which renders when I click on the "+" icon in sidebar.html (see screen image below). Keep in mind that the reportmaint view contains the left and right TreeViews:
<section data-report-wizard id="reportmaint-view" class="mainbar" data-ng-controller="reportmaint as vm">
<section class="matter">
<div class="container-fluid">
<div class="row-fluid">
<div class="col-md-12">
<div class="widget wlightblue">
<div data-cc-widget-header title="{{vm.wizardStep}}" subtitle="" allow-collapse="true"></div>
<div class="widget-content">
<div class="clearfix">
<!-- Wizard steps 1 thru 4 omiteed for brevity -->
<div id="wizard4" class="reportwizard">
<div class="row-fluid">
<h3>Choose KRIs</h3>
<h4>Selected: {{vm.selectedItem.text}}</h4>
<div class="col-sm-6"> <!-- kendo TreeView widgets -->
<span id="treeview-left" kendo-tree-view="tree"
k-options="vm.treeOptions"
k-datasource="vm.kriDataSource1"
k-on-change="vm.onTreeSelect(kendoEvent)"
</span>
</div>
<div class="col-sm-6">
<span id="treeview-right" kendo-tree-view="tree"
k-options="vm.treeOptions"
k-data-source="vm.kriDataSource2"
k-on-change="vm.onTreeSelect(kendoEvent)">
</span>
</div>
</div>
<div class="buttons">
<button class="goto5" ng-click="vm.wizardStep='Report Dimensions'">Next</button>
<button class="cancel-btn backto3" ng-click="vm.wizardStep='Report Dimensions'">Back</button>
<button class="cancel-btn close-popup">Close</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
css code in reportmaint.html :
<style scoped>
#treeview-left, #treeview-right {
color:#000;
}
.k-textbox {
width: 11.8em;
}
.demo-section {
width: 700px;
}
.reportwizard {
width: 510px;
height: 323px;
margin: 0 auto;
padding: 10px 20px 20px 170px;
}
.reportwizard h3 {
font-weight: normal;
font-size: 1.4em;
border-bottom: 1px solid #ccc;
}
.reportwizard ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.reportwizard li {
margin: 7px 0 0 0;
}
textarea {
vertical-align: top;
}
label {
display: inline-block;
width: 90px;
text-align: right;
}
.required {
font-weight: bold;
}
.accept, .status {
padding-left: 90px;
}
.valid {
color: green;
}
.invalid {
color: red;
}
span.k-tooltip {
margin-left: 6px;
}
</style>
and my sidebar.html with css code which styles the left TreeView "reports" menu :
<div style="float:left;">
<span id="treeview" kendo-tree-view="tree"
k-options="vm.treeOptions"
k-data-source="vm.reportsTree"
k-on-change="vm.onTreeSelect(kendoEvent)">
</span>
</div>
<style scoped>
.k-treeview .k-plus, .k-treeview .k-minus, .k-treeview .k-plus-disabled, .k-treeview .k-minus-disabled {
background-image: url("../../Content/kendo/2014.1.624/Uniform/sprite.png");
background-position: -161px -192px;
width: 10px;
height: 11px;
cursor: pointer;
margin-left:-10px;
}
#treeview_tv_active > div > span.k-icon.k-plus {
background-image: url("../../Content/kendo/2014.1.624/Uniform/sprite.png");
background-position: -176px -192px;
width: 10px;
height: 11px;
}
#treeview_tv_active > div > span.k-icon.k-minus {
background-image:url("../../Content/kendo/2014.1.624/Uniform/sprite.png");
background-position: -177px -211px;
width: 10px;
height: 11px;
}
#treeview {
color: #fff; /* white */
}
</style>
Again, once I click on the "+" sign I navigate to reportmain.html. This is when the sidebar treeview styling inadvertently changes; and the background-image folder icon gets hidden.
thanks.
Bob

Related

Position element in relation to a list element

I'm trying to make a pop-up options box appear next to each one of the elements of a file list. This window show the options available for that files.
I'm using an onClick function that toggle classes between one hidden and the other visible. My problem is that the box is placed always in the same place, despite the file you click, so it seems like you are always opening the options from the first file.
The React code:
return (
<div className='file-row'>
<div className='file-row-1'>
<div className='checkbox-iconFile-container'>
<input className='checkbox-folder' type="checkbox"/>
<p id={props.id} className='file-name'><img className='resourceIcon'alt='tipo de documento' src={resourceIcon}></img>{newStr}</p>
</div>
<p className='file-date'>{date}</p>
<p className='groups-file-text'>UBIP,...</p>
</div>
<div className='div-hidden-options'>
<ModalResources></ModalResources>
<div className='moreInfo-dots-container' onClick={showFileOptions}>
<img className='moreInfo-dots' alt='Opciones' src={dots}></img>
</div>
<div id='file-options' className='div-file-options-hidden'>
<p>Modificar título</p>
<p>Modificar archivo</p>
<p>Mover recurso</p>
<p>Eliminar recurso</p>
</div>
</div>
</div>
)
The showFileOptions function :
function showFileOptions () {
let optionsDiv = document.getElementById('file-options');
optionsDiv.classList.toggle('div-file-options-show');
}
And the CSS:
.div-hidden-options {
width: 15%;
display: flex;
flex-direction: row;
justify-content: space-between;
}
.div-file-options-hidden {
visibility: hidden;
position: absolute;
}
.div-file-options-show {
visibility: visible;
position: absolute;
margin-left: 15%;
background-color: white;
border: 1px solid #DDDDDD;
padding: 5px;
border-radius: 5px;
margin-top: -36px;
}
And an image of the position that the box takes regardless of the file we click:
And this is the desirable behaviour of the box when the second file is clicked:

CSS Grid: how to make grid cell a hyperlink target?

I am designing a simple two-column layout with CSS Grid; the grid areas are named Cell1 and Cell2. In the left column (Cell1) I want a list of hyperlinks; when a hyperlink is clicked, I want the content to open in the right column (Cell2).
I think I could use bookmarks to content already loaded into Cell2, but I prefer a way to display content in the right cell when a link is clicked, without using bookmarks.
Using a CSS Grid layout, is there any way to designate a cell where content should go when a hyperlink is clicked, other than the cell that contains the hyperlinks -- using bookmarks or anything else?
Thanks very much for any info.
Yes, this is possible, but is much easier to do if you are permitted to use JavaScript/jQuery. Here is an example of using HTML and CSS only to accomplish what you need:
a {
text-decoration: none;
color: #333;
}
.tabs {
position: relative;
clear: both;
}
.tabs .tab {
float: left;
margin-right: 10px;
}
.content {
position: absolute;
background-color: white;
width: 100%;
left: 0px;
}
.tabs .tab:nth-of-type(1) .content {
z-index: 1;
}
.tab:target a {
font-weight: bold;
}
.tab:target .content {
z-index: 1;
}
<div class="tabs">
<div class="tab" id="tab1">
Tab 1
<div class="content">Content of Tab1</div>
</div>
<div class="tab" id="tab2">
Tab 2
<div class="content">Content of Tab2</div>
</div>
<div class="tab" id="tab3">
Tab 3
<div class="content">Content of Tab3</div>
</div>
</div>

Pseudo Class :hover stopped working but :focus still works CSS

I am programing a webpage with html and CSS. My pseudo class :hover stopped working on my webpage, but :focus still works. Hover was working fine, and then I made an unrelated edit (added an image to one of my blocks), and noticed it had stoped working. I deleated my last change and it still did not work.
I have checked everything and ran both the html and css through validators and there are no errors other than something about using character encoding, but I know it worked fine without that. It really makes no sense!
I will show my page and my code. Keep in mind this is my very first webpage, I know that I did not optimize my background images properly, and may have some unnecessary divs, but I feel pretty good about it considering a week ago I did not know what html was. I have heavily commented and organised my CSS, you can find my hover code near the top along with the rest of the none classes/ID's. The hover link is the only link on the webpage on the sidebar.
http://www.adrianhoulewebprojects.com/HomePage.html
Here is my HTML
<!--Home Page for adrianhoulewebpojects.com Version 1.0-->
<!--Written by Adrian Houle-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/HomePageStyle.css">
<title>Adrian Houle Web Projects</title>
</head>
<body>
<div id="Sidebar">
<h3>Projects</h3>
<ul>
<li>
Under Construction
</li>
<li>Unfinished Project #2</li>
<li>Unfinished Project #3</li>
<li>Unfinished Project #4</li>
<li>Unfinished Project #5</li>
</ul>
</div>
<div class="box">
<div class="HalfSpacer"></div>
<div class="TransBox" id="Header">
<h1>Welcome to<br>AdrianHouleWebProjects.com</h1>
</div>
<div class="Spacer"></div>
<div class="TransBox" id=About>
<h2>About:</h2>
<p>Welcome to my website. I had a bit of time over the holidays and decided to finally get around to learning web programming. The purpose of this website is to give me a place to practice and display what I learn in the form of web projects. I may also be making some blogs that will also serve to showcase my travelling and hobbies.</p>
</div>
<div class="Spacer"></div>
<div class="TransBox" id="NewStuff">
<h2>Coming Soon</h2>
<ul>
<li>
<h3>Australia Travel Blog</h3>
<img src="http://www.adrianhoulewebprojects.com/img/AustralianFlag100by50.gif" alt="Australian Flag" >
<p>2013-2014 Australia Travel Blog coming soon.</p>
</li>
</ul>
</div>
<div class="Spacer"></div>
<div class="TransBox" id="Contact">
<h2>Contact Info:</h2>
<p class="Italic">Please report any compatibility, accessibility, or security issues to:</p>
<p>Adrian Houle</p>
<p>adrianhoule#gmail.com</p>
</div>
<div class="Spacer"></div>
<div class="TransBox" id="Footer">
<p>Website by Adrian Houle</p>
</div>
</div>
<div class="BottomBorder"></div>
</body>
</html>
Here is my CSS
/***************************************** Info *********************************************************/
/*Style Sheet for HomePage of adrianhoulewebprojects.com*/
/*Written by Adrian Houle*/
/*For any issues with my website (compatibility, accessibility, white-hat reports) feel free to contact me at
adrianhoule#gmail.com
/*Page Purpose: Create a homepage that welcomes users to my website and directs them to various projects*/
/***********************************************************************************************************/
/************************************* Table of Contents **************************************************/
/*CSS layout*/
/* -none specific elements*/
/* -classes*/
/* -ID's and children of ID's*/
/* -Other*/
/************************************************************************************************************/
/************************************** CSS code ****************************************************/
/* -none specific elements ***********************************************************************************/
p {
font-size: large;
font-weight: bolder;
}
a {
color: blue;
}
a :hover, :focus{
background-color: yellow;
text-decoration: none;
font-size: larger;
}
/* -classes **************************************************************************************************/
/*Element that contains everything except the sidebar and has the main background image.*/
.box {
display: block;
position: relative;
width: 100%; /*test and adjust to keep it from expading the browser*/
height: 100%;
border: 3px solid black;
right: 0;
top: 0px;
padding: 0;
background-image: url(http://www.adrianhoulewebprojects.com/img/CautionStripes.png);
}
/*Allows for synchronised space adjustment between elements*/
.Spacer {
position :relative;
height: 100px;
}
/*Allows for synchronised space adjustment between elements*/
.HalfSpacer {
position :relative;
height: 30px;
}
/*Every element that contains text belongs to this class*/
/*This class has nothing to do with transgender boxes, or gender boxes in general*/
.TransBox {
width: 70%;
padding: 1em;
z-index: 1;
left: 20%;
position: relative;
background-image: url(http://www.adrianhoulewebprojects.com/img/SteelPlate.jpg);
moz-box-shadow: 0 0 5px 5px #888; /*shadow effect with cross compatibility*/
webkit-box-shadow: 0 0 5px 5px#888;
box-shadow: 0 0 5px 5px #888;
}
.Italic {
font-style: Italic;
}
/* -ID's and children of ID's********************************************************************************/
/*Sidebar, to be fixed to the left hand side of the screen. Must allow conent to the right of it*/
#Sidebar {
height: 100%;
width: 10%;
left: 0px;
top: 0px;
padding: 2%;
display: inline;
position: fixed;
background-image: url(http://www.adrianhoulewebprojects.com/img/SteelPlate.jpg);
border-style: solid;
border-width: 3px;
z-index: 2;
}
#Sidebar ul {
padding-left:0;
}
#Sidebar li {
margin: 10%;
}
/*Header text*/
#Header h1 {
text-align: center;
}
#Footer p {
text-align: center;
}
/* -Other (empty)*****************************************************************************************/
Thank you for any help.
CSS is very touchy about putting extra spaces in it. Combine a with :hover like this:
a:hover, a:focus{
background-color: yellow;
text-decoration: none;
font-size: larger;
}
Also want to make it a:focus unless you want every element to be affected.
Remove the space between a and :hover
a:hover{
background-color: yellow;
text-decoration: none;
font-size: larger;
}

CSS Expander with only CSS

i don't want to flood my visitors display with all news, so i want to use expanders for each news. But i want to support vistors with JavaScript disabled too.
My try:
#news > .panel > .panel-heading > .panel-title > .label{
float: right;
}
#news > .panel > .panel-body {
display: none;
}
#news > .panel > panel-heading > panel-title > a:visited < .panel-title < .panel-heading < .panel > .panel-body {
display: block;
}
<div id="news" class="tab-pane active">
{% for announcement in server.announcements.all %}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{{ announcement.title }} <span class="label label-default">By {{ announcement.writer.get_username }} at {{ announcement.date_created }}</span></h3>
</div>
<div class="panel-body">
{{ announcement.content|safe_html }}
</div>
</div>
{% endfor %}
</div>
You need to make some changes
First, you will never (at current CSS3 capablity) be able to get what you desire using pure CSS using the :visited psuedo-class for two reasons: (1) the a element is not at the sibling level of the .panel-body, so it cannot control .panel-body through css, and (2) the :visited pseudo-class has severe restrictions on what it allows a designer to control (for privacy reasons).
So what can you do? Use :target instead.
But that will (1) limit you to allowing only one news item open at a time, and (2) requires you to set id properties on your .panel-body elements to match the href of the a tag controlling it. So you would need html structure like this:
<div id="news" class="tab-pane active">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Title 1
<span class="label label-default">By writer name</span>
</h3>
</div>
<div class="panel-body" id="Item1">
Panel 1 body
</div>
</div>
</div>
Where each a has a unique href that is tied to the id of the .panel-body of the item. Then you can get the functionality similar to what you seek by this CSS for the display:
#news > .panel > .panel-body {
display: none;
}
#news > .panel > .panel-body:target {
display: block;
}
You can see how this works in this fiddle example, and to see how it would work with multiple news items, take a look at this fiddle example.
This solution is only CSS3 compatible, so older browsers with javascript disabled would not be able to see any news items (with javascript you can use that to expand)
Graceful degradation:
I would show all news in a container with internal scrollbar (constrained in height) as in : http://jsfiddle.net/Py2HU/1/
And when JS available would add a Show/Hide button, hide N last news and show/hide them after a click (or add Previous/Next buttons to allow scrolling news one by one)
CSS
.news-wrapper {
width: 300px;
max-height: 400px;
overflow: auto;
border: 1px solid #000;
}
HTML
<div class="news-wrapper">
<ul class="news">
<li class="news-item">Lorem ipsum </li>
<li class="news-item">Lorem ipsum </li>
<li class="news-item">Lorem ipsum </li>
<li class="news-item">Lorem ipsum </li>
</ul>
</div>
Compatibility: IE7+ and easily with IE6 (as simple as .ie6 .news-wrapper { height: 400px } if anyone cares)
This answer is for people who are looking for Single expander only with CSS3.
Bootstrap reference is given only to use Glyph-icons(Up/Down).
check Plunker
HTML
<div class="expandercheckbox">
<input id="e1" type="checkbox" checked="checked" />
<label for="e1" class="expanderheader">Click me to Expand/Collpase</label>
<div class="expandercontainer">
I am in container. I am visible. Click above to make be collpase.
</div>
</div>
CSS
body{
padding:50px;
background: #484848;
color:#fff;
}
.expandercheckbox input[type="checkbox"] {
display: none;
}
.expandercheckbox .expanderheader {
cursor: pointer;
}
.expandercheckbox input[type="checkbox"] + .expanderheader {
color: #fff;
font-weight: bold;
font-size: 12px;
white-space: nowrap;
user-select:none;
-webkit-user-select:none;
}
.expandercheckbox input[type="checkbox"] + .expanderheader:before {
content: "\e113";
display: inline-block;
font: 14px/1em Glyphicons Halflings;
height: 20px;
width: 20px;
border-radius: 20px;
margin: -2px 0.25em 0 0;
padding: 1.5px 3.5px;
vertical-align: top;
background: #717171;
/* Old browsers */
}
.expandercheckbox input[type="checkbox"]:checked + .expanderheader:before {
content: "\e114";
padding: 2.5px;
}
.expandercheckbox input[type="checkbox"]:checked + .expanderheader:after {
font-weight: bold;
color:#000;
}
.expandercontainer{
background:#000;
padding:15px;
}
.expandercheckbox input[type="checkbox"]:checked ~ .expandercontainer {
display: block;
}
.expandercheckbox input[type="checkbox"]:not(:checked) ~ .expandercontainer {
display: none;
}

Content from <p> disappears when I return to the page

I'm facing a strange problem. I use a HTML template and it's actually only one page with a box in the middle. The content of the box can change and you navigate to the different version by some buttons at the top of the page.
I have added a paragraph in the landing view and when I move to another view and return back the text disappears.
I can see that the problem isn't that it doesn't show the text, the problem is that it completely disappears and only leaves:
<div id="comment2" class="one-half"></div>
I cannot figure out what causes it though.
Here's my HTML:
<div id="content_wrapper">
<div id="header"><span>Το <b>INTRO HALL</b> είναι το <b>TOP</b>!</span><div id="close"></div></div>
<div id="content">
<div class="scroll-pane">
<div class="content" id="content1">
<div id='subscribe_label'>Η ιστοσελίδα του γυμναστηρίου Intro Hall θα ανοίξει σε:</div>
<div id="counter"></div><div class="clear"></div>
<div class="form_title"><h1>Κέρδισε ένα δώρο!</h1></div>
<div class="column_cont">
<div id="comment2" class="one-half"><p>Συμπλήρωσε τη διπλανή φόρμα για να μπεις στο Club Επικοινωνίας του Intro Hall και κέρδισε ένα δώρο. Απλά γράψε το όνομα και το email σου και κλίκαρε 'Στείλτε το δώρο μου!'.</p></div>
<!-- Begin MailChimp Signup Form -->
<div id="mc_embed_signup" class="one-half" style="float:right;">
<form action="http://topgreekgyms.us6.list-manage2.com/subscribe/post?u=d6acf8949532b107b7b21c9d0&id=e2131451dc" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div class="mc-field-group">
<input type="text" value="" name="FNAME" class="required" id="firstname" placeholder="Όνομα">
</div>
<div class="mc-field-group" style="margin-bottom:4px;">
<input type="email" value="" name="EMAIL" class="required email" id="primaryemail" placeholder="Email" style="float:right;">
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div>
<div class="clear"><input type="submit" value="ΣΤΕΙΛΤΕ ΤΟ ΔΩΡΟ ΜΟΥ!" name="subscribe" id="mc-embedded-subscribe" class="button_link hover_fade large_button red"></div>
</form>
</div>
<!--End mc_embed_signup-->
</div>
</div>
And here's the CSS
#content_wrapper {
position:absolute;
width:506px;
height:506px;
z-index: 1000;
top:0;
left:0;
/* Fallback for web browsers that doesn't support RGBa */
background: rgb(62, 62, 62);
/* RGBa with 0.6 opacity */
background: rgba(0, 0, 0, 0.52);
}
#header {
width:506px;
height:47px;
background: #161616;
}
#header span {
display:block;
margin:auto;
height: 100%;
line-height: 47px;
width:447px;
color: #ffffff;
padding: 0px 29px 0 29px;
background: #ac0003;
text-align:center;
font-family: arial;
font-size: 23px;
text-transform: none;
word-spacing: 5px;
}
#content {
width: 502px;
height: 306px;
border: 2px solid #161616;
border-width: 0 2px 0 2px;
margin-top:-15px;
padding-top:15px;
}
.content {
display:none;
width: 458px;
}
#close {
position: absolute;
top:11px;
right:12px;
background: transparent url(../img/close.png) no-repeat;
width:25px;
height: 25px;
cursor: pointer;
display:none;
}
.column_cont {
margin: 0 -15px 0 0px;
clear:both;
}
.clear {clear:both;}
#comment2 {
color: #fff;
display:block;
font-size: 16px;
text-align: justify;
line-height: 20px;
margin-bottom:10px;
}
.one-half, .one-third, .two-third, .one-fourth, .three-fourth {
margin:0 5px 0 15px;
float:left;
}
.one-half {
width:206px;
}
Also, here's a link to the website.
Thanks in advance for any help or opinions!
In your big_countdown.js file, there is a listener on the close button which contains document.getElementById('comment2').innerHTML = ""; :
$("#close").click(function() {
$('.content').each(
function() {
$(this).fadeOut('fast');
});
$('#content1').stop().fadeIn('fast');
$("#close").css('display','none');
$('#dots div').each(
function() {
$(this).removeClass('dot_active');
});
$("#dot1").addClass('dot_active');
window.setTimeout(function() {
api.reinitialise();
},300);
// Remove this line below
document.getElementById("comment2").innerHTML="";
});
Removing this last line should solve the problem.
Using a good JavaScript debugger can help you figure this out really quickly next time. Firebug, an add-in to Fixfox is one of the best. To get to the same answer as albertxing you can do the following steps:
Load the page
Right click on the element that is disappearing and select "Inspect element with Firebug"
Your element will be highlighted in Firebug's HTML viewer
Right-click on on this element and select "break on element removal"
Toggle the buttons at the bottom of your web page to make the element disappear
Firebug will detect the change and take you immediately to the line of code that caused it to change.
Presto!

Resources