Overlap border-left CSS - php

I have a menu with some css on it.
I activate it when the page is active
<li <?php echo (strpos(current_url(), 'history') !== false) ? "class='active'" : ""; ?>>
History
</li>
I also have css for menu it self when is hover and focus
.side-nav li a:hover,
.side-nav li a:focus {
outline: none;
background-color: #f8f8f8 !important;
font-weight: bold;
border-left: 6px solid #337AB7;
-webkit-box-shadow: -4px 4px 6px -4px #a5a5a5;
box-shadow: -4px 4px 6px -4px #a5a5a5;
}
And class active is
.side-nav li.active{
background-color: #f8f8f8 !important;
font-weight: bold;
border-left: 6px solid #337AB7;
-webkit-box-shadow: -4px 4px 6px -4px #a5a5a5;
box-shadow: -4px 4px 6px -4px #a5a5a5;
}
My problem is when active class is active and i hover over the menu bar i have 2 borders on that element.
How can i remove the second border when element is active?

Your problem is, that you are accessing two different elements with your css. With the first definition you are accessing the pseudo-selectors :focus and :hover on any a element within a li element in your .side-nav. With the second definition you are only accessing the li element, and not the contained a element. Defining your .active class as follows should fix your problem:
.side-nav li.active a {
background-color: #f8f8f8 !important;
font-weight: bold;
border-left: 6px solid #337AB7;
-webkit-box-shadow: -4px 4px 6px -4px #a5a5a5;
box-shadow: -4px 4px 6px -4px #a5a5a5;
}

Related

Can I use CSS to replace a large icon with smaller icon?

I have a WordPress site that changes shopping cart icons when you scroll. In its original state, a very large icon is displayed. Upon scroll, a smaller, more desirable icon is displayed. I am wanting to replace the larger icon with the smaller icon at all times but I am having trouble targeting the larger icon in the code. How can I replace the larger icon at all times? My site is https://pennwoods.com.
I have opened the dev tools in Chrome and targeted each div. When I make a change that affects the larger icon, it seems to have the same effect on the smaller one. I am a CSS rookie.
element.style {
/* display: none; */
}
.top-form.top-form-minicart {
padding: 12px 10px 1px 1px;
}
.top-form.top-form-minicart {
cursor: pointer;
padding: 26px 24px 18px;
background: #617348;
-webkit-border-radius: 0 6px 6px 0;
-moz-border-radius: 0 6px 6px 0;
-o-border-radius: 0 6px 6px 0;
-ms-border-radius: 0 6px 6px 0;
border-radius: 0 6px 6px 0;
}
.top-form {
position: relative;
float: right;
}
.pull-right {
float: right;
}
.pull-right {
float: right;
}
.pull-right {
float: right;
}
.pull-right {
float: right;
}
*, html {
outline: 0!important;
}
*, *:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
div {
display: block;
}
I am expecting the smaller icon to show at all times in place of the large icon.
Change font-size in before to resize(16px to match the other icons) your icon.
And also you need to change padding: 40px 10px 0px;
Nice catch by Madhu Jayarama.
.top-form.top-form-minicart .top-minicart-icon:before {
font-size: 15px;
}
.top-form.top-form-minicart .top-minicart-icon .minicart-number {
right: 0px;
}
.top-form.top-form-minicart {
padding: 40px 10px 0px;
}
.top-form.top-form-minicart {
padding: 6px 5px 1px 1px;
}
.top-form.top-form-minicart {
cursor: pointer;
padding: 13px 12px 9px;
background: #617348;
-webkit-border-radius: 0 6px 6px 0;
-moz-border-radius: 0 6px 6px 0;
-o-border-radius: 0 6px 6px 0;
-ms-border-radius: 0 6px 6px 0;
border-radius: 0 6px 6px 0;
}
Please change the padding. I have reduced it by half.

How add a link to a pseudo element in jQuery without modifying HTML? - Updated > Functions.php

I'm trying to assign a url to a pseudo element (button) next to the h1. I'm working on a specific WordPress page that I cannot modify because the h1 is the entry-title.
The problem is I cannot use h1.entry-title::after to assign a link. Can someone help me please?
var $j = jQuery.noConflict();
$j(document).ready(function() {
$j("h1.entry-title::after").click(function() {
window.open('http://www.google.com/');
});
});
#pageid1 h1.entry-title::after {
content: 'contact Yes Link';
right: 80px;
position: absolute;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
color: #fff;
font-size: 28px;
font-weight: 600;
padding: 0px 13px;
background-color: #95c11e;
box-shadow: 10px 10px 17px 1px rgba(0, 0, 0, .23);
-webkit-box-shadow: 10px 10px 17px 1px rgba(0, 0, 0, .23);
-moz-box-shadow: 10px 10px 17px 1px rgba(0, 0, 0, .23);
text-decoration: none;
display: inline-block;
cursor: pointer;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="pageid1">
<h1 class="entry-title"> Title Page - No Link </h1>
</div>
You can use javascript to get pseudo content and append a link to H1.
Here is the CSS code:
/* Add pseudo at first */
#pageid1 h1.entry-title::after {
content: 'contact Yes Link';
right: 80px;
position: absolute;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
color: #fff;
font-size: 28px;
font-weight: 600;
padding: 0px 13px;
background-color: #95c11e;
box-shadow: 10px 10px 17px 1px rgba(0, 0, 0, .23);
-webkit-box-shadow: 10px 10px 17px 1px rgba(0, 0, 0, .23);
-moz-box-shadow: 10px 10px 17px 1px rgba(0, 0, 0, .23);
text-decoration: none;
display: inline-block;
cursor: pointer;
}
/* Remove pseudo */
#pageid1 h1.entry-title.pseudoed::after {
display: none;
}
/* Style your link like pseudo */
#pageid1 h1.entry-title .my-pseudo-link {
right: 80px;
position: absolute;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
color: #fff;
font-size: 28px;
font-weight: 600;
padding: 0px 13px;
background-color: #95c11e;
box-shadow: 10px 10px 17px 1px rgba(0, 0, 0, .23);
-webkit-box-shadow: 10px 10px 17px 1px rgba(0, 0, 0, .23);
-moz-box-shadow: 10px 10px 17px 1px rgba(0, 0, 0, .23);
text-decoration: none;
display: inline-block;
cursor: pointer;
}
And here is the JS/jQuery code:
var $j = jQuery.noConflict();
$j(document).ready(function() {
var pseudoLink = $j('').html(window.getComputedStyle(document.querySelector('#pageid1 h1.entry-title'), ':after').getPropertyValue('content'));
$j('#pageid1 h1.entry-title').addClass('pseudoed').append(pseudoContent);
});

Multi level sub menu

I am trying to create a multi level submenu.
I can display just one sub level menu with this code.
How to increase the code to insert a system with parent id ?
There my code than I am trying to develop.
<style>
* {
margin: 0;
padding: 0;
}
body {
font-family: "Comic Sans MS", cursive;
font-size: 15px;
color: #232323;
}
#head {
background: #f9f9f9;
height: 100px;
padding-top: 15px;
border-bottom: 1px solid #d5dce8;
}
.wrap {
width: 1000px;
margin: 0 auto;
}
#head h1
{
float:left;
}
#head a
{
float:right;
}
input,select
{
width:300px;
height:35px;
}
/* nav menu */
#nav {
margin: 0;
padding: 0;
list-style: none;
border-left: 1px solid #d5dce8;
border-right: 1px solid #d5dce8;
border-bottom: 1px solid #d5dce8;
border-bottom-left-radius: 4px;
-moz-border-radius-bottomleft: 4px;
-webkit-border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
-moz-border-radius-bottomright: 4px;
-webkit-border-bottom-right-radius: 4px;
height: 50px;
padding-left: 15px;
padding-right: 15px;
background: #f9f9f9;
}
#nav li {
float: left;
display: block;
background: none;
position: relative;
z-index: 999;
margin: 0 1px;
}
#nav li a {
display: block;
padding: 0;
font-weight: 700;
line-height: 50px;
text-decoration: none;
color: #818ba3;
zoom: 1;
border-left: 1px solid transparent;
border-right: 1px solid transparent;
padding: 0px 12px;
}
#nav li a:hover, #nav li a.hov {
background-color: #fff;
border-left: 1px solid #d5dce8;
border-right: 1px solid #d5dce8;
color: #576482;
}
/* subnav */
#nav ul {
position: absolute;
left: 1px;
display: none;
margin: 0;
padding: 0;
list-style: none;
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
-o-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
padding-bottom: 3px;
}
#nav ul li {
width: 180px;
float: left;
border-top: 1px solid #fff;
text-align: left;
}
#nav ul li:hover {
border-left: 0px solid transparent;
border-right: 0px solid transparent;
}
#nav ul a {
display: block;
height: 20px;
line-height: 20px;
padding: 8px 5px;
color: #666;
border-bottom: 1px solid transparent;
text-transform: uppercase;
color: #797979;
font-weight: normal;
}
#nav ul a:hover {
text-decoration: none;
border-right-color: transparent;
border-left-color: transparent;
background: transparent;
color: #4e4e4e;
}
</style>
<script type="text/javascript">
$(document).ready(function()
{
$('#nav li').hover(function()
{
$('ul', this).slideDown('fast');
}, function()
{
$('ul', this).slideUp('fast');
});
});
</script>
<div class="wrap">
<ul id="nav">
<?php
// Select all entries from the menu table
$Qmenus = $Db->prepare('SELECT a.id,
a.link,
a.parent,
a.class,
a.sort_order,
amd.label
FROM :table_administrator_menu a,
:table_administrator_menu_description amd
where a.id = amd.id
and amd.language_id = :language_id
ORDER BY a.parent,
a.sort_order
');
$Qmenus->bindInt(':language_id', $OSCOM_Language->getId());
$Qmenus->execute();
while($Qmenus->fetch()){
?>
<li class="<?php $Qmenus->value('class'); ?>"><?php echo $Qmenus->value('label'); ?>
<?php
// Select all entries from the menu table
$QsubMenus = $Db->prepare('SELECT sm.id,
sm.link,
sm.parent,
sm.class,
smd.label,
sm.sort_order
FROM :table_administrator_sub_menu sm,
:table_administrator_sub_menu_description smd
where sm.sub_menu_id = smd.sub_menu_id
and smd.language_id = :language_id
order by sm.parent,
sm.sort_order
');
$QsubMenus->bindInt(':language_id', $OSCOM_Language->getId());
$QsubMenus->execute()
?>
<ul>
<?php
while($QsubMenus->fetch()) {
?>
<li class="<?php $QsubMenus->value('class'); ?>"><?php echo $QsubMenus->value('label'); ?></li><?php
}
?>
</ul>
</li>
<?php
}
?>
</ul>
</div>

My form submit buttons are not displaying like my a link html buttons

I have a page here:
http://www.simplypsychics.com/psychicprofile.php?pin=4439
and at the bottom I am using buttons. But my site has a standard button style which I use in the following way:
View all our great psychics
The CSS applied to it is this:
.placementtext_button {
background-color: #9a3ba8;
background-image:url(headerbuttons2.jpg);
border-radius:5px;
margin: 10px 10px 10px 10px;
color:#5c5c5a;
font-family:"Century Gothic", sans-serif !important;
font-size:14px !important;
padding:8px !important;
vertical-align: top;
line-height:33px;
text-align:center;
text-decoration:none;
-webkit-text-size-adjust:none;
-webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.18);
-moz-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.18);
box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.18);
}
.placementtext_button:hover {
background-color: #494949;
background-image:url(headerbuttons2.jpg);
border-radius:5px;
margin: 10px 10px 10px 10px;
color:#f8c7ff;
font-family:"Century Gothic", sans-serif !important;
font-size:14px !important;
padding:8px !important;
vertical-align: top;
line-height:33px;
text-align:center;
text-decoration:none;
-webkit-text-size-adjust:none;
-webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.18);
-moz-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.18);
box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.18);
}
but my PHP buttons look completely different. See this image to explain:
http://i61.tinypic.com/102jck1.jpg
and I tried to modify the CSS to appear the same but it isn't working.
Does anyone know where I am going wrong?
This is the CSS for the button:
form input[type="submit"] {
background-color: #9a3ba8;
border-radius: 5px;
margin: 10px 10px 10px 10px;
color: #5c5c5a;
font-family: "Century Gothic", CenturyGothic, AppleGothic, 'Muli', sans-serif !important;
font-size: 14px !important;
padding: 8px !important;
vertical-align: top;
line-height: 33px;
text-align: center;
text-decoration: none !important;
-webkit-text-size-adjust: none;
-webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.18);
-moz-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.18);
box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.18);
}
Try this:
form input[type="submit"] {
background-color: #9a3ba8;
border-radius: 5px;
margin: 10px 10px 10px 10px;
font-family: "Century Gothic", CenturyGothic, AppleGothic, 'Muli', sans-serif !important;
font-size: 14px !important;
padding: 0px !important;
vertical-align: top;
line-height: 33px;
text-align: center;
text-decoration: none !important;
-webkit-text-size-adjust: none;
-webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.18);
-moz-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.18);
box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.18);
letter-spacing: -1px;
font-weight: bold;
color: #ffffff;
border: none;
}
ssergei's on the right track. The key, in this case, is border: none;.
This could also all be consolidated a lot more; there's no need to repeat styles that aren't changing during a hover state. And, if possible, it's best to style similarly styled selectors together (separated by commas) to keep your code cleaner and smaller.
.placementtext_button,
form input[type="submit"] {
background-color: #9a3ba8;
border-radius: 5px;
border: none;
margin: 10px 10px 10px 10px;
color: #ffffff;
font-family: "Century Gothic", CenturyGothic, AppleGothic, 'Muli', sans-serif !important;
font-size: 14px !important;
padding: 8px !important;
vertical-align: top;
line-height: 33px;
text-align: center;
text-decoration: none !important;
-webkit-text-size-adjust: none;
-webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.18);
-moz-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.18);
box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.18);
}
.placementtext_button:hover,
form input[type="submit"]:hover {
background-color: #494949;
color:#f8c7ff;
}

Menu items don't have same height

I am using wordpress on my site, marblesandmore.com, and have a theme that I currently am adjusting.
The website is using a menu function build in to wordpress and the items use cufon and css.
The problem is the following:
- the last 2 items have an offset...?
- This is only visible in chrome and IE.
The php used:
<div id="menu">
<?php $menuClass = 'nav superfish clearfix';
$menuID = 'secondary-menu';
$secondaryNav = '';
if (function_exists('wp_nav_menu')) {
$secondaryNav = wp_nav_menu( array( 'theme_location' => 'secondary-menu', 'container' => '', 'fallback_cb' => '', 'menu_class' => $menuClass, 'menu_id' => $menuID, 'echo' => false, 'walker' => new description_walker() ) );
};
if ($secondaryNav == '') { ?>
<ul id="<?php echo $menuID; ?>" class="<?php echo $menuClass; ?>">
<?php if (get_option('estore_swap_navbar') == 'false') { ?>
<?php show_categories_menu($menuClass,false); ?>
<?php } else { ?>
<?php if (get_option('estore_home_link') == 'on') { ?>
<li <?php if (is_home()) echo('class="current_page_item"') ?>><?php esc_html_e('Home','eStore') ?></li>
<?php }; ?>
<?php show_page_menu($menuClass,false,false); ?>
<?php } ?>
</ul> <!-- end ul#nav -->
<?php }
else echo($secondaryNav); ?>
</div> <!-- #menu -->
Css:
ul#secondary-menu { padding: 24px 0px 0px 23px; margin-top:24px; }
ul#secondary-menu li { padding-right: 20px; }
ul#secondary-menu li.current_page_item > a > strong, ul#secondary-menu li.current-menu-item > a > strong { color:#ede7c2; }
ul#secondary-menu li a strong { color:#000000; text-transform: lowercase; font-size:16px; font-weight:normal; text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3); margin-bottom:-3px; }
ul#secondary-menu li a span { color: #828282; font-family: arsmaquettepro,Helvetica, sans-serif; /*text-shadow: 1px 1px 1px #2d2d2d;*/ }
ul#secondary-menu li a:hover { text-decoration: none; }
ul#secondary-menu li a:hover strong { color: #ede7c2; }
ul#secondary-menu li a:hover span, ul#secondary-menu li > a > span { color: #7b786a; }
There should be no difference between the first 4 items and the next 2.
Any idea what causes the offset?
Marblesandmore.com
EDIT: The answer below appears to be right, so the solution has to be in the css of the submenu:
ul#secondary-menu ul { width: 178px; background: url(images/secondary-dropdown.png) repeat-y; padding: 3px 0px 15px; box-shadow: 3px 6px 7px 1px rgba(0, 0, 0, 0.5); -moz-box-shadow:3px 6px 7px 1px rgba(0, 0, 0, 0.5); -webkit-box-shadow: 3px 6px 7px 1px rgba(0, 0, 0, 0.5); border-radius: 8px; -moz-border-radius: 8px; -webkit-border-radius: 8px; border-top-left-radius: 0px; -moz-border-radius-topleft: 0px; -webkit-border-top-left-radius: 0px; border-top-right-radius: 0px; -moz-border-radius-topright: 0px; -webkit-border-top-right-radius: 0px; border: 1px solid #ffffff; border-top: none; }
ul#secondary-menu li:hover ul, ul#secondary-menu li.sfHover ul { left:0px; top:43px; }
ul#secondary-menu li:hover ul ul, ul#secondary-menu li.sfHover ul ul { left:173px; top:-3px; border-radius: 8px; -moz-border-radius: 8px; -webkit-border-radius: 8px; border: 1px solid #232323; }
ul#secondary-menu ul li { background: url(images/secondary-dropdown-bottom.png) repeat-x bottom left; padding: 0px 0px 2px 2px; }
ul#secondary-menu ul li a { display: block; padding: 9px 3px 9px 28px; width: 145px; /*font-weight: bold; */font-size:14px; color: #000000; font-family: arsmaquettepro, Helvetica, Arial, sans-serif; /*text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3); background: url(images/secondary-dropdown-bullet.png) no-repeat 15px 17px;*/ }
ul#secondary-menu ul li a:hover { background-color: #383838; color: #ede7c2; }
I think your problem may be is caused by:
margin-bottom:-3px;
in
ul#secondary-menu li a strong
selector.
I can't see your page, so im not sure about that answer.
The last 2 object only have a 16px height while the other menu objects got 18px.
edit: Sorry i just realized how bad this answer is without telling you where the problem is.. Will try to check it.
i think it has something to do with the fact that the last 2 menu items has no submenus, somehow those ul tags for the submenus seem to add 2px to the height.
Ok, this is not a "nice" solution, rather ugly to be honest, but i think it works. You can just target the 2 last items in the menu by using their id's and adding a margin at the top.
#menu-item-3606, #menu-item-3604 {
margin-top: 2px;
}
just remember that if u ever change those menu items in any way, they will have new identifiers so you would need to change the id's in the css. As I said, not a good solution but it works.
There would also be problem if you for some reason added submenus to these two menu items.
#Bart van Sleeuwen Please Remove this class from style.css
ul#secondary-menu li#menu-item-3604 strong { color:#666666; }
ul#secondary-menu li#menu-item-3606 strong { color:#666666; }
and Find the li class in html
<li id="menu-item-3604" class="menu-item menu-item-type-post_type menu-item-object-page">
change it to like this
<li id="menu-item-3604" class="menu-item menu-item-type-custom menu-item-object-custom">

Categories