PrimeVue Menubar - css

I created a drop down menu with menubar. However I have custumization problems :
The transparency is well done, but the size of the horizontal items is too hight (and so not vertically centered. The required height is thirty pixels all inclusive ;
(just resolved with height: 30px; in passive mode (neither hover nor seleted). The selection "Button" item in the horizontal menu remains too hight
The vertical menu items are too separated from each over and the width of the vertical menus too narow ;
The movement in the verticals menu items not be materialized (with a blue color) as it is in the horizontal menu;
Impossible to move to a submenu with a mouse. Only with keybord arrows. Why ?
I tried a long time the css with modification of the "theme.css" of the saga-blue theme, but nothing to do nothing works except the css lines included in my code :
Code:
.p-menubar {
background: transparent;
padding: 0;
height: 30px;
}
What are the particular css elements and clauses to modify ?

Eventually, using Chrome's inspector, I ended up discovering the CSS classes involved. By groping on the values I got about what I wanted.
The impacted code:
In the vue.js file:
<div id="menuU" class="user-menu" v-show="isvisible()">
<Menubar:model="items" class="p-menubar"></Menubar>
</div>
the v-show parameter is application specific and not given here.
In css:
.menu-utilisateur {
background-color: lightgrey;
height: 30px;
}
.p-menubar {
background-color: lightgrey;
padding: 0px;
height: 30px;
}
.p-menubar .p-menubar-root-list > .p-menuitem > .p-menuitem-link {
padding: 0.5rem 1rem !important;
}
.p-menubar .p-menuitem-link {
padding: 0.5rem 0.5rem !important;
}
Don't forget the !important. It overwrites the default values.

Related

Distorted css Top for Safari

Currently I'm trying to implement some generic tooltips with no use of javascript (based only on css). For that I use a wrapper div with a wrapper css class and the tooltip class that has certain display attributes along with some margin-top and margin-left values to leave space for the hovered element.
It works on Chrome and Firefox, but in Safari the top value seems to be multiplied by the window scrolling putting way below the tooltip.
Does anyone has an idea of the workaround required for Safari?
The css classes:
.generic-tooltiptext {
visibility: hidden;
background-color: #333;
color: #fff;
border: solid thin #000;
text-align: center;
border-radius: 4px;
padding: 0px 5px;
margin-top: 20px;
margin-left: 20px;
position: absolute;
z-index: 1;
}
.generic-tooltip:hover .generic-tooltiptext {
visibility: visible;
transition-delay:0.75s;
}
This interacts with a react component:
interface GenericTooltip{
style?: CSSProperties;
text: string
}
export const GenericTooltip : React.FC<GenericTooltip> = ({style, text, children}) => {
return <div
style={style}
className="generic-tooltip">
<div className="generic-tooltiptext">
{text}
</div>
{children}
</div>
}
Just found out the problem doesn't have to do with margin: if I set margin to 0 the problem keeps appearing.
Changed the code to:
.generic-tooltiptext {
display: none;
/*--------------------*/
.generic-tooltip:hover .generic-tooltiptext {
display: block;
On the other hand, if I use display none / block as mechanism for conditional display, this "top margin" problem get's to be resolved... although the time lapse for the effect is taken out.
So there's some curious behaviour of visibility field within safari.

Kendo TreeView selected CSS inside div

I had this kendo treeview. When select a node or sub's-node I want the orange color at full line and same with others (refer to image below).
I to use script below, but when it come to sub's-group the align is not same. Appreciate your help.
.k-treeview span.k-in {
margin-left: -10%;
padding-left: 10%;
padding-right: 60%;
}
DEMO IN DOJO
The way the tree currently works is that the li.k-item have a left padding of 16px, so for the second level it's 32px and so on.
What you need to do is put the indenting mechanism somewhere else. Your li.k-item must have no left padding, but a div inside must. Depending on your item template, it will be something like:
.k-treeview li > div { padding-left: 16px }
.k-treeview li li > div { padding-left: 32px }
.k-treeview li li li > div { padding-left: 48px }
You can generate a dozen levels with less or sass.
When you have this, you can style the selected row:
li[aria-selected="true"] { border: 2px solid orange }

QTabWidget - tab icons not in the center

I have a QTabWidget with six tabs, and all the tabs have an icon -
but the icons are not in the center of the tab:
What I've done so far :
tabWidget->setStyleSheet("QTabBar::tab {width: 40px; height: 40px;}"
"QTabBar::tab:selected {background: lightblue;}");
tabWidget->setIconSize(QSize(40, 40));
tabWidget->addTab("widget", QIcon("iconPath"), ""); //<--for all six tabs
And:
tabWidget->setTabIcon(index, QIcon("iconPath"));
Any ideas why this is happening, and how I can fix it?
I too have been struggling with this issue. Here is how I resolve it.
Background:
I was attempting to get a left side tab menu going, which used icons as its indicators (what the users would see), however I had a problem:
My icons, which were set using the currentTabIcon in the Property Editor, were aligning to the bottom (which is expected since I am using the West orientation. Normally, the North orientation would be selected and the icons would be on the left).
I had this as my stylesheet:
QTabBar::tab:hover {
background-color: #212121;
}
QTabBar::tab:selected{
background-color: #313131;
}
QTabBar::tab {
background-color: #111111;
height:70px;
width: 70px;
border: none;
}
Now, attempting the suggested solution found in this post whereby I set the margins did not have the desired effect, infact it had no effect at all.
Solution:
After playing around with some of the CSS properties, I discovered that setting the padding-top and padding-bottom gave me the desired result.
adding the lines:
padding-top: -15px;
padding-bottom: 15px
Resolved the problem for me, however this needs to be changed according to your needs.
My final stylesheet resembles:
QTabBar::tab:hover {
background-color: #212121;
}
QTabBar::tab:selected{
background-color: #313131;
}
QTabBar::tab {
background-color: #111111;
height:70px;
width: 70px;
border: none;
margin: 0px;
padding-top: -15px;
padding-bottom: 15px
}
If somebody has the same problem like me with the icons in the tabs, I found a solution after days and days search for this, and its so simple :D
Just add this to the stylesheet for the TabWidget:
tabWidget->setStyleSheet("::tab {margin: 0px;}");
************

Wordpress Nav Menu: vertical position different on some pages

Problem
I can't get a consistent position for my navigation menu vertically. It is presently in the correct position on most pages, but on internal e-course pages it is lower and I don’t know why. I've changed the code a bit in trying to figure things out and I can no longer find the vertical positioning code—though I thought it was there when I looked at it a few days ago and yet the position on most pages is correct!
I wonder what is the position measuring from?. I coded it (when I thought there was a code for the vertical position) thinking it was measuring from the top of the page which is something that doesn't change from page to page, but if that were the case it would not change on the internal e-course pages.
Motive
I need a second navigation menu on a Wordpress site I am setting up for e-courses. The navigation menu that comes with the theme is set above the header and I want a navigation at the bottom of the header that matches and basically links my other sites. The menu should basically look like the ones here: http://www.midlifecrisismarriageadvocate.com/stand.html and at my blog. Though I think I would like it if it were more like the second (WP blog) example where all the items do not spread out to take up the entire width of the navigation bar.
I added the second menu by following the instructions from this post: http://premium.wpmudev.org/blog/add-menus-to-wordpress/. I've also posted my latest problem ther—though I recently changed the css again—with no resolution to my problem. I also posted my problem at the wordpress.org forums and received no response.
Theme
I am using a child theme I created from the theme that came with the Zippy Courses plugin—social triggers for zippy courses theme.
CSS Code
Sorry for all the notes; I got this from some online tutorial and customized it for my colours. I've added to some of the notes with my changes, comments or confusions.
.top-nav {
height: 45px;
padding: 0;
margin: 0;
position: absolute; /* Ensures that the menu doesn’t affect other elements */
border-right: 0px /*solid #a5dcc2; */
}
.top-nav li {
height: auto;
width: auto; /* Each menu item was 148px wide, changed to auto */
float: left; /* This lines up the menu items horizontally */
/*text-align: center;*/ /* All text is placed in the center of the box, removing this changed nothing--text is still centered */
list-style: none; /* Removes the default styling (bullets) for the list */
/*font: normal bold 14px;*/
font-family: Georgia, Verdana, Arial, sans-serif;
padding: 0;
margin: 0;
background-color: #b7f5d7;
}
/*The next code styles the anchor tags that are found in each list item. Each anchor tag is the same size and shape as the list item.*/
.top-nav a {
padding: 2px 0; /* Adds a padding on the top and bottom so the text appears centered vertically */
border-left: 0px solid #BEF6DB;
border-right: 0px solid #a5dcc2;
text-decoration: none; /* Removes the default hyperlink styling. */
color: c91640
display: block;
}
/*The next style is responsible for changing the color of each menu item’s background when hovered over with a mouse pointer. .*/
.top-nav li:hover, a:hover {
background-color: #82bfa2;
font-color: #ffffff
}
/*The next two styles are related. The first style hides the drop-down menu, while the second style displays it when a mouse pointer is hovered over the main menu item.*/
.top-nav li ul {
display: none; /* Hides the drop-down menu */
height: auto;
margin: 38px; /* Aligns drop-down box underneath the menu item */
padding: 0; /* Aligns drop-down box underneath the menu item */
}
.top-nav li:hover ul {
display: block; /* Displays the drop-down box when the menu item is hovered over */

Hover Opacity & Text Woes

I am trying to do a little optimization on my website and it has brought me to what seems to be a quite common topic but I haven't been able to find a problem quite like mine.
What I had. A image sprite (foggy/clear) and text on top of it. When you hovered over the image it could become clear, when you hovered over the text it would highlight and turn blue. (The image would remain clear)
What I want. To reduce the sprite into one image (rather than two in one), as it is the largest file on my main page and 57% of my load time is spent on images.
What I have done:
1) Gone from a sprite to just one clear image.
2) Created a new 'foggy-img' div container, placed it on top of the image, white with opacity: 0.15
3) Created a new div 'img-text' container for the text to put it outside the 'foggy-img' so the opacity doesn't effect it and have got it nicely place where it should be.
The Problem: It is small, the see-through box has replaced the sprite nicely and works. The text also highlights nicely. But. When one hovers over the text the see-through box becomes 'foggy' again.
Is there any way to keep the 'foggy-box' clear when hovering over the text which is in a separate div?
The HTML:
<div id="photo-feature">
<a href="services.html">
<div id="img">
<div id="photo-fog"></div>
<div id="photo-text"><h3>Learn More...</h3></div>
</div>
</a>
</div>
The CSS:
#photo-feature a { text-decoration: none; }
#photo-feature #img { margin: 4px 5px 0 4px; width: 565px; height: 283px; background: url(images/photo-feature.png) 0 0; }
#photo-feature #img #photo-fog { height: 100%; background-color: #fff; opacity: 0.15; }
#photo-feature #img #photo-fog:hover { opacity: 0; }
#photo-feature #img #photo-text { position: absolute; margin-top: -34px; margin-left: 428px;}
#photo-feature #img #photo-text h3 { float: left; display: inline; color: #fff; }
#photo-feature #img #photo-text h3:hover { color: #0066cc; text-decoration: underline; }
You could use adjacent siblings selector.
(further details)
It doesn't work in older browsers though (guess which).
You would have to swap the ordering of your HTML a bit. Basically put the text first then use something like this:
#photo-text:hover + #photo-fog { // Do something
Right now you'd not be able to set the hover on the H3, but why not just style up the h3 rather than the #photo-text element then it would work fine.
Edit: Beautifully colour co-ordinated js fiddle for you to take a look at: http://jsfiddle.net/will/Gt8KX/
Hope that helps :)

Resources