I'm currently setting up a sidebar menu for my Wordpress website. I'm running into 2 issues. The 1st one is that the text in the menu isn't lining up to the left side properly. I have tried to use the text-align attribute but it doesn't work.
The 2nd problem is that there is a bit of random space at the bottom of the menu that I don't know why is there.
Problem is happening here: http://dreamedbig.com/our-services/
My HTML/PHP:
<div class="page-content">
<div id="services-menu" class="services-sidebar">
<?php dynamic_sidebar('services'); ?>
</div>
</div>
The CSS:
#services-menu {
border: 1px solid black;
align-items: left;
float:left;
height: auto;
display: inline-block;
top:0;
left:0;
background-color: #BCE6FB;
}
#services-menu li{
list-style-type:none;
border-bottom: 1px solid black;
}
#services-menu a {
text-decoration: none;
color: #08203D;
}
#services-menu ul {
}
#services-menu ul li a {
position: relative;
display: block;
box-sizing: border-box;
z-index: 1;
margin: 5px;
padding-left: 5px;
padding-right: 5px;
}
#services-menu ul li a::after
{
content: "";
position: absolute;
top:0;
left: 0;
background-color: #00A2DA;
width: 0%;
height: 100%;
transition: all 1s;
z-index: -1;
}
#services-menu ul li a:hover::after
{
width: 100%;
}
#services-menu ul li:nth-child(odd) a::after
{
background-color: #00A2DA;
}
#services-menu ul li:nth-child(even) a::after
{
background-color: #FFFFFF;
}
It looks like you have some inherited styles from classes called .widget and there is margin and padding added to ul. This is common is your using something like WordPress or underscores that come with some stylesheets.
I think these styles will correct it
.widget, #services-menu ul{
margin:0;
padding:0;
}
I found the unwanted margin and padding by using inspect in my chrome browser. I highly recommend it for frontend styling because it makes troubleshooting these kinds of issue easier to resolve.
Here is an article to better explain how it works
Related
Im trying to make the anchor tag as button and trying to add some css on it but it is not clickable
Here is my html code.
I'm following a youtube tutorial, I followed the video 100% but mine is not working, Im sorry im just new in web developing thankyou for the help.
<body>
<!-- Welcome Page -->
<section id="ulambg">
<div class="ulambg container">
<div>
<h1>Eatwell</h1>
Ready to Eat
Ready to Cook
</div>
</div>
</section>
<!-- End Welcom Page -->
And this is the css I used in the program, is it because of the Java? I read some forum that says some java function wont work if you disabled your java on your machine.
#import url('https://fonts.googleapis.com/css2?family=Raleway:wght#600&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 15px;
font-family: 'Raleway', sans-serif ;
}
a {
text-decoration: none;
}
.container {
min-height: 100vh;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
/*Welcome Page Section Ulambg*/
#ulambg {
background-image: url(./img/bg.jpg);
background-size: cover;
background-position: top center;
position: relative;
}
#ulambg::after {
content: '';
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
background-color: black;
opacity: .5;
}
#ulambg h1 {
color: white;
width: fit-content;
font-size: 4rem;
position: relative;
}
#ulambg .btnulam {
display: inline-block;
padding: 10px 30px;
color: blue;
background-color: transparent;
border: 2px solid blue;
font-size: 2rem;
text-transform: uppercase;
letter-spacing: .1rem;
margin-top: 30px;
transition: .3s ease;
transition-property: background-color;
}
#ulambg .btnulam:hover {
color: white;
background-color: blue;
}
/*Welcome Page Sectio Ulambg*/
add z-index: -1 in #ulambg::after, it's background, should not cover the page.
Demo
if i understand u correct, u mean <a href="#".. <- Anchor tag isnt clickable?
If yes u need to give it a name like <a href="#goHere".. and this means the link points to an id somewhere on the page ( for example to: <img id="goHere" src="/img/pic.gif"...
I'm new to the stuff myself but hopefully i could help in any way :)
I built a plugin to display a full page tab after you call the shortcode.
This is how it looks when I run it.
When I installed it however this is how it looks
As you can see not only is the tab not a full page, the tabs stylesheet has managed to affect the entire site and disorganized it.
I want to make the tab full width(from one end of the page to another) and I want the style for the plugin to only affect the slider returned by the plugin.
I use elementor page builder and I've tried setting the elementor container's margin to 0. It reduced the space but it's still not enough as you can see from the image. My site's layout is already set to 100% full-width. I would appreciate any help I can get.
Here's the CSS for the plugin below.
.elementor-container {
margin: 0px !important;
}
.bs-example {
margin-top: 20px;
margin-bottom: 20px;
}
.hide23 {
border-style: none !important;
}
.tab-pane {
margin: 20px;
}
.selected {
border-bottom: 2px solid #FF7F50;
}
#media screen and (min-device-width: 300px) {
.tab-content {
width: 50% !important;
}
}
#media screen and (max-width: 800px) {
/* li {width:50%;}*/
ul {
display: none !important;
}
}
#media all and (max-width: 959px) {
.elementor-container {
max-width: 100% !important;
}
.elementor-column-gap-default {
max-width: 100% !important;
}
}
h3 {
font-size: 2vw;
color: black;
}
a {
background-color: #fff !important;
}
ul:hover {
color: transparent!important;
}
ul {
border-style: none !important;
/*border-bottom: 2px solid #FF7F50 !important;*/
}
{
display: inline !important;
color: black;
}
.span-active {
border: 2px solid #FF7F50;
border-radius: 100%;
font-size: 15px;
padding-right: 5px;
padding-left: 5px;
margin-right: 5px;
margin-left: 5px;
margin-top: -5px;
color: white;
background-color: #FF7F50;
}
.span-inactive {
border: 2px solid grey;
border-radius: 100%;
font-size: 15px;
padding-right: 5px;
padding-left: 5px;
margin-right: 5px;
margin-left: 5px;
margin-top: -5px;
color: grey !important;
background-color: white;
}
.inactive {
color: grey !important;
}
.progress-bar {
background-color: #FF7F50;
}
Let me know if you need anything else. I apologize if the answer is obvious. I'm new to WordPress development
I'm using bootstrap4 fixed-top navbar which works fine in normal browser.
However, when I test on a mobile device (Galaxy S5 using chrome dev options) the content starts behind the nav bar, I've tried some padding in my css but I can't seem to get it to work correctly.
Below is a jsfiddle of the HTML and CSS, the page content starts behind the fixed-top nav bar.
https://jsfiddle.net/8kefh4u7/6/
Also here is my CSS
html,
body {
height: 100%;
}
body {
display: -ms-flexbox;
display: -webkit-box;
display: flex;
-ms-flex-align: center;
-ms-flex-pack: center;
-webkit-box-align: center;
align-items: center;
-webkit-box-pack: center;
justify-content: center;
padding-top: 40px;
padding-bottom: 40px;
background-color: #f5f5f5;
}
.epg-container {
position: relative;
width: 100%;
max-width: 1500px;
overflow: hidden;
display: block;
margin: 0 auto;
background-color: black;
}
.epg-container ul.listings-grid {
list-style-type: none;
padding: 0;
margin: 0;
white-space: nowrap;
background-color: #262626;
}
.epg-container ul.listings-grid li {
font-size: 20px;
text-align: left;
}
.epg-container ul.listings-grid .listings-channel-row {
height: auto;
padding: 0;
border-bottom: solid;
border-bottom-width: 6px;
border-color: #262626;
overflow: hidden;
}
.epg-container ul.listings-grid .listings-channel {
/* color not necesary */
color: white;
width: 20%;
height: 83px;
float: left;
text-align: center;
}
.epg-container ul.listings-grid .listings-channel img {
max-width: 100%;
max-height: 100%;
}
.epg-container ul.listings-grid .listings-program {
color: #989898;
border-right: solid;
border-right-width: 3px;
border-left: solid;
border-left-width: 3px;
border-color: #262626;
float: left;
padding: 10px 10px;
background-color: black;
}
.epg-container ul.listings-grid .listings-details-now-info {
color: #fa9609;
font-size: 12px;
}
.epg-container ul.listings-grid .listings-details-next-info {
color: #fa9609;
font-size: 12px;
}
What would be the best way to make the content page always start under the NAVBAR that would work well on mobile.
The recommended method is padding-top on the BODY, the same height as the navbar...
body {
padding-top: 56px;
}
From the Bootstrap docs..
"Fixed navbars use position: fixed, meaning they’re pulled from the normal flow of the DOM and may require custom CSS (e.g., padding-top on the ) to prevent overlap with other elements."
It is unreliable to use a fixed amount for the height of the header to introduce a padding-top to the body element. I'm using this bit of code after a page refresh to set the body to the correct height.
$("body").css({'padding-top': $('nav.navbar').height()});
The navbar is identified using the nav element with the navbar class.
I fixed this so now the content will always start after the fixed nav bar.
I added the below to the body css
min-height: 51.5rem;
padding-top: 2.5rem;
Thank you #ZimSystem for pointing me in the right direction.
I run some of the web stuff at work on the side, not exceptionally experienced at this stuff. I don't know what element of the process I've gone through has caused the hiccup so if you bear with me, I'll try and explain in-depth.
Recently our site (basic bootstrap template) has begun expand out from just a few pages, and to stay on top of things I opted to pull the header and footer files out into their own includes folder, and use...
<!--Header include-->
<?php $path = $_SERVER['DOCUMENT_ROOT'] . "/includes/"; include ( $path . 'header.html' ); ?>
...for easier management. Went through the site and stripped out old code and changed page extensions to php (and now began testing site on MAMP).The structure of the site is 75% of pages living in root, 25% living in a folder called services. All pages pull the same header.html So far so good.
The problem arrises when I test the site. All pages that live in root (public_html) work as expected, the nav drop down menu contained in the header works fine. But when you click into any of the pages that live in /services/ the dropdown (and only the dropdown), breaks. By breaks, I mean that a dropdown should appear on mouse hover over and it doesn't. All of the other CSS, the theme, the code for a picture slider, works ok. It's just this one element of the nav bar that breaks for these pages that live in the /services/ folder.
I compared the elements of a working page and a broken page by inspecting them firefox, and this is the only place I can see any differences..
On a working page, the working dropdown html shows as...
ul class="dropdown-menu bold" style="display:none;"
With CSS rules of...
element {
display: none;
}
.navbar .nav li .dropdown-menu {
z-index: 1000;
}
header ul.nav li ul {
z-index: 1000;
margin-top: 20px;
}
.bold {
font-weight: 900;
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0px;
z-index: 1000;
display: none;
float: left;
min-width: 180px;
padding: 0px;
margin: 2px 0px 0px;
list-style: outside none none;
background: none repeat scroll 0% 0% #343434;
box-shadow: none;
border-right: 2px solid #302F2F;
border-width: medium 2px 2px;
border-style: none solid solid;
border-color: -moz-use-text-color #302F2F #302F2F;
-moz-border-top-colors: none;
-moz-border-right-colors: none;
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
border-image: none;
}
.dropdown-menu {
border-radius: 0px;
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0px;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 5px 0px;
margin: 2px 0px 0px;
list-style: outside none none;
background-color: #FFF;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 6px;
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.2);
background-clip: padding-box;
}
ul ul, ul ol, ol ol, ol ul {
margin-bottom: 0px;
}
ul ul, ul ol, ol ol, ol ul {
margin-bottom: 0px;
}
ul, ol {
padding: 0px;
margin: 0px 0px 10px 25px;
}
ul, ol {
padding: 0px;
margin: 0px 0px 10px 25px;
}
li {
line-height: 1.6em;
}
li {
line-height: 20px;
}
.nav {
list-style: outside none none;
}
body {
font-family: "Open Sans",sans-serif;
font-size: 14px;
font-weight: 400;
line-height: 1.6em;
color: #656565;
}
body {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
line-height: 20px;
color: #333;
}
html {
font-size: 100%;
}
The broken page(s) shows html of...
<ul class="dropdown-menu"></ul> <<< I think this might be a red flag??
and CSS of....
element {
}
.navbar .nav li .dropdown-menu {
z-index: 1000;
}
header ul.nav li ul {
z-index: 1000;
margin-top: 20px;
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0px;
z-index: 1000;
display: none;
float: left;
min-width: 180px;
padding: 0px;
margin: 2px 0px 0px;
list-style: outside none none;
background: none repeat scroll 0% 0% #343434;
box-shadow: none;
border-right: 2px solid #302F2F;
border-width: medium 2px 2px;
border-style: none solid solid;
border-color: -moz-use-text-color #302F2F #302F2F;
-moz-border-top-colors: none;
-moz-border-right-colors: none;
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
border-image: none;
}
.dropdown-menu {
border-radius: 0px;
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0px;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 5px 0px;
margin: 2px 0px 0px;
list-style: outside none none;
background-color: #FFF;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 6px;
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.2);
background-clip: padding-box;
}
ul ul, ul ol, ol ol, ol ul {
margin-bottom: 0px;
}
ul ul, ul ol, ol ol, ol ul {
margin-bottom: 0px;
}
ul, ol {
padding: 0px;
margin: 0px 0px 10px 25px;
}
ul, ol {
padding: 0px;
margin: 0px 0px 10px 25px;
}
li {
line-height: 1.6em;
}
li {
line-height: 20px;
}
.nav {
list-style: outside none none;
}
body {
font-family: "Open Sans",sans-serif;
font-size: 14px;
font-weight: 400;
line-height: 1.6em;
color: #656565;
}
body {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
line-height: 20px;
color: #333;
}
html {
font-size: 100%;
}
(I can manually change the broken dropdown in firefox inspect to element { display:inline } and the dropdown reappears, with working links to the other pages.)
Overall, I can't understand why this is happening.
All of the other CSS is working on the broken pages, so the links to that location must work.
All pages share the same header.html which uses the same html to create the working dropdowns.
All CSS is called individually at the start of each page in the head (not in the header.html file).
If all pages look at the same header file, and they all point to the same CSS, how am I getting different results?
Thanks,
Found the answer to this a while ago and I figured I'd update. The javascript that animates the nav bar was written out and contained in the footer with relative links to the js folder, which hadn't been updated when the pages were moved into the services folder. So the animations would fail because the javascript files couldn't be located.
Fixed this by making the footer as its own file in an includes folder with explicit links to the js folder from there, then used a php document root include (same as the code above) to bring it into the other pages.
I have a Joomla site using Mosets Tree for a business directory. On the right side all the categories are listed. If the sub-categories for an item are expanded, for example under GENERAL SERVICES and you roll over the next menu item (GOVERNMENT AGENCIES), all the sub-category items above get highlighted, which obviously shouldn't happen.
http://www.downtownnewwest.ca/index.php/directory/general-services
The CSS looks like this:
#sidebar ul {
list-style:none;
margin: 0;
padding-left:0;
}
#sidebar .active ul li a {
text-transform: none;
margin-left: 10px;
}
#sidebar ul.menu li a {
display: block;
width: 190px;
color: #00215b;
padding: 10px 20px 10px 20px;
border-bottom: 1pt solid #ccc;
text-decoration: none;
}
#sidebar ul.menu li a:hover {
background: #00215b;
color: #fff;
}
Thanks in advance.
You would use the direct child combinator, >, in order to only select the direct li children elements of ul.menu. Additionally, the anchor elements should be inline-block as opposed to block:
This will fix the issues:
#sidebar ul.menu > li > a {
width: 190px;
color: #00215b;
padding: 10px 20px 10px 20px;
border-bottom: 1pt solid #ccc;
text-decoration: none;
display: inline-block;
}