The main navigation menu on wordpress twenty twelve theme is left aligned by default. I am trying to center align the menu on my child theme but just cannot figure it out. Any suggestions?
If you use Firefox with the add-on Firebug, you can inspect the CSS of the header menu bar to find the appropriate code. I happen to use a child theme of Twenty Twelve myself, which also features center aligned menu items.
Assuming you are using a self-hosted website with the WordPress.org script, it should be a simple fix, as follows:
1) If you haven't already, you'll need to create a child theme. To do this, simply create a new folder in the 'themes' directory of your WordPress installation, and name it something like 'Twenty Twelve Child Theme'. For more information on child themes, see this page.
2) You will now need to create a new style sheet file for your child theme, and make it load the stylesheet for the parent theme, or your site will load without any styles. To do this, open Notepad and add the following.
/*
Theme Name: Twenty Twelve Child Theme
Theme URI:
Description: Child theme for Twenty Twelve
Author: <You Name here>
Author URI:
Template: twentytwelve
Version: <Add any number to your liking here, for instance '0.5'>
*/
#import url("../twentytwelve/style.css");
The section wrapped in slashes with asterikses is a comment. You can add comments anywhere in your style sheet to label and organize your customizations. The following '#import' rule loads the stylesheet of the parent theme, so that your child theme does not render your website as a mere skeleton.
Save this file to your child theme directory with the file name 'styles.css', and remember to select 'All files' in 'File type' list.
3) Now that the base of the child theme has been created, we can proceed to the customization part. First we will add the CSS rule for the theme's navigation menu into the child theme's style sheet. This code already exists within the parent theme's style sheet, so we are practically going to override it with our customization.
.main-navigation ul.nav-menu, .main-navigation div.nav-menu > ul {
border-bottom-color: #EDEDED;
border-bottom-style: solid;
border-bottom-width: 1px;
border-top-color: #EDEDED;
border-top-style: solid;
border-top-width: 1px;
display: inline-block !important;
text-align: left;
width: 100%;
}
The declarations within this CSS rule define the appearance of the navigation menu as a container. To center align the menu elements, simply replace the value of the 'text-align' property with 'center'.
Save the file again and reload your website; the menu items should now be center aligned.
Within your Dashboard > Appearance > Editor, open your 'style.css' and scroll down until you see the heading;
/* =Main content and comment content
-------------------------------------------------------------- */
scroll down slightly and add the line text-align: center; to the bottom of your .entry-header .entry-title leaving the rest as it is.
..having done the above, here's what mine code looks like;
.entry-header .entry-title {
font-size: 20px;
font-size: 1.428571429rem;
line-height: 1.2;
font-weight: normal;
text-align: center;
}
Add this code part to your container div's css.
margin:0 auto;
it'll make the div align center.
Just add the lign: text-align: center; to .main-navigation
It should look like:
.main-navigation {
clear: both;
margin: 0 auto;
max-width: 1080px;
min-height: 45px;
position: relative;
text-align: center; }
Related
I am trying to figure out how to change the font size of the navigation bar on my company's website: http://bicycle.ns.ca/
I've tried to edit the CSS through the theme that is currently installed but no changes occur still.
I also dived into the themes style.css file and tried various things like:
a {
font-size: 25px;
}
to no avail. Can someone point me in the right direction?
you need to edit properties of top menu tag.. try this!
.top-menu a
{
color: #6b6b6b;
font-size: 25px; <!–– Try Editing Here ––>
line-height: 12px;
display: block;
}
You can change the font site of the menu items in menu by adding the following CSS property for menu links
.top-menu a{
font-size: 12px !important;
}
Right now I'm making nicely formatted CSS files for our temporary WordPress site, until the new site is ready. After making a CSS style sheet and pretty HTML files, I found they didn't work in WordPress if they were inline in a post, but instead I had to put them in a separate raw HTML file (using "WP File Manager" plugin to upload them to a separate folder.) After that, the way they display on the site matched what they look like on my HDD or on my personal (LAMP) test site (using Safari 10.1.1 OS X), and if I display source in my browser it looks identical to what I uploaded.
Then I created a tooltip style with CSS following the tutorial on w3schools. In the style sheet I define "edit" as a style for changes I made to the original text
.edit { /* changes made, */
color: navy;
position: relative;
display: inline-block;
}
.edit .tooltip {
font-size: medium;
visibility: hidden;
background-color: navy;
color: white;
text-align: center;
width: 20em;
padding: 0.5em;
border-radius: 6px;
position: absolute;
z-index: 1;
}
.edit:hover .tooltip{
visibility: visible;
}
Then (per the tutorial) I add "tooltip" text inside "edit" text
<h5 class="edit">¶ Then shall be said or sung the following Canticle.
<span class="tooltip">This canticle is most commonly used.</span></h5>
On my HDD and my personal site, the tooltip is invisible until I hover over it and then it pops up a balloon.
But when I load it onto WordPress, the hidden text is always visible inline, as if the "tooltip" style is ignored. To work around this bug for now (so I don't have to re-edit the HTML files), I was able to disable and hide all the tooltips by defining the tooltip style as
.edit .tooltip {
visibility: hidden;
font-size: 0%;
}
This suggests that the "tooltip" is being seen, but some aspect of the hidden part is being parsed differently on WordPress.com.
So is there some CSS style or property that WordPress could be using that causes my text to be shown? Any way to pre-emptively override this with CSS? Should I write a JavaScript that goes through and manually hides the tooltips?
Any experiments I should try to make it go away?
PS: This is different than the question at CSS Tooltip will not work on WordPress page because my text is shown inline.
You are saying:
But when I load it onto WordPress, the hidden text is always visible inline, as if the "tooltip" style is ignored.
This is an indication that the file with the styles for tooltip is loaded before other css styles are loaded. Thus files that load last override what's been loaded before.
For debugging, try adding !important to your tooltip style rules like this:
.edit .tooltip {
visibility: hidden !important;
font-size: 0%;
}
and see if that makes any changes.
Then, modify your WordPress files so that your tooltip styles are loaded last. That will allow you to remove the !important flag. (because using that flag is not a best practice and should be avoided whenever possible)
I installed a free responsive image slider plugin, Slider by WD, for my WordPress theme, and I need to edit the styles. Specifically, I can see that I need to edit the class .wds_slideshow_image_wrap_0:
You can see that I need the width of this div to span 100% of the width of its parent container wds_container2_0:
I need for the max-width: 800px; style that's applied to .wds_slideshow_image_wrap_0 to go away, so I tried to copy and paste the styles for this class into my stylesheet, and commented out max-width: 800px;. But as you can see this is having no effect.
When scrolling up, in the Styles tab of the inspector, I notice that the source file / line for these styles is at (index):101
Since I can't edit the styles when doing this in my stylesheet:
#wds_container1_0
#wds_container2_0
.wds_slideshow_image_wrap_0 {
background-color: rgba(0, 0, 0, 0.00);
border-width: 0px;
border-style: none;
border-color: #000000;
border-radius: ;
border-collapse: collapse;
display: inline-block;
position: relative;
text-align: center;
width: 100% !important;
/* max-width: 800px; */
box-shadow: ;
overflow: hidden;
z-index: 0;
}
how can I access this index file to change the width of this div to match the width of its parent container? Thanks!
EDIT: In WordPress, the index.php file that you see in the browser is the combination of other the files - header.php, footer.php, front-page.php (or page.php depending on your setup), and maybe sidebar.php. So you can't search for elements in index.php - that file is not the same as what's getting rendered in the browser.
Instead, SSH into your server and do a grep command in the terminal to search for the element in question:
https://mediatemple.net/community/products/dv/204403684/connecting-via-ssh-to-your-server
https://www.siteground.com/tutorials/ssh/searching/
You can overide the styles through your style sheet. By targeting a custom container in which the style is or by using !important(which is not advisable)
FOr example to target this "#wds_slideshow_image_wrap_0" ? you can use
body #wds_container2_0 .wds_slideshow_image_wrap_0 {
/**your code**/
max-width: 100%;
}
OR
body #wds_container2_0 div.wds_slideshow_image_wrap_0 {
/**your code**/
max-width: 100%;
}
copy the above code to you style sheet
I am currently building a simple prestashop webshop for some products I sell. I like PrestaShop's default bootstrap theme and there are just some minor things i'd like to adjust.
One of them is the top menu. I already changed the colors, font and added a top border but there is one thing still bugging me and i can seem to remove it!
It is the line underneath the menu items, as shown in the picture attached:
I am editting the superfish-modified.css file found in the modules --> blocktopmenu --> css folder.
All other changes I wanted to implement were also done via that very same CSS.
The (already somewhat modified) CSS file can be found here:
http://lutijn.nl/superfish-modified.css
you declare this with your css:
.sf-menu > li > a {
font: 600 18px/22px "Montserrat", sans-serif;
text-transform: uppercase;
color: #484848;
display: block;
padding: 17px 20px;
border-bottom: 2px solid #e9e9e9; }
just remove the border-bottom set it to none
I'm trying to use WP Web Scraper plugin with WP in my site www.eastwickpark.co.uk to get online ratings of the practice from another site
https://www.iwantgreatcare.org/gpsurgeries/eastwick-park-medical-practice
I used this code snippet
<img src="http://www.eastwickpark.co.uk/wp/wp-content/uploads/2015/11/iwantgreatcarelogo.png" />
<div>
[wpws url="https://www.iwantgreatcare.org/gpsurgeries/eastwick-park-medical-practice" query=".image-middle" basehref="1" ]
</div>
Then I used custom CSS in the themes stylesheet editor
.btn.blue,
div .btn.blue {
font-size: 16px;
padding: 8px 16px;
}
/*** Stars ***/
.sprite-icons.star-blue-outline {
background-image: url('http://www.eastwickpark.co.uk/wp/wp-content/uploads/2015/11/star-blue-outline.png');
width: 19px;
height: 17px;
}
.sprite-icons.star-blue-fill {
background-image: url('http://www.eastwickpark.co.uk/wp/wp-content/uploads/2015/11/star-blue.png');
width: 19px;
height: 17px;
}
.sprite-icons.star-blue-half {
background-image: url('http://www.eastwickpark.co.uk/wp/wp-content/uploads/2015/11/star-blue-half.png');
width: 19px;
height: 17px;
}
.sprite-icons.caret-white {
background-image: url('http://www.eastwickpark.co.uk/wp/wp-content/uploads/2015/11/caret-white.png');
width: 10px;
height: 14px;
}
I've got a problem with my CSS in that the button "wraps".
Tried to just get the star rating targeting the class "raty-rating-wrapper-readonly" part but then I get a whole load of vertical stars.
i.e. if i use
[wpws url="https://www.iwantgreatcare.org/gpsurgeries/eastwick-park-medical-practice" query=".raty-rating-wrapper-readonly" basehref="1" ]
I get a whole vertical list of 5 * images?
If I use image-middle div like this
[wpws url="https://www.iwantgreatcare.org/gpsurgeries/eastwick-park-medical-practice" query=".image-middle" basehref="1" ]
I get a weird wrap on the button.
Can't figure this out, and have to admit I'm not a CSS guru. Any insight would be gratefully received.
I've got a problem with my CSS in that the button "wraps"
The cause of the wrapping behaviour is due to <br> tag dynamically generated by WordPress. You can either fix it by following the guideline here: Stop WordPress automatically adding <br> tags to post content
The above post is a plus for you because it also removes the <p> tags that are dynamically generated. I just browsed through your code and found a lot of unwanted p tags.
Can't figure this out, and have to admit I'm not a CSS guru. Any
insight would be gratefully received.
Since you hinted for a CSS solution, a simple fix is to hide the br tags using #widgets .textwidget br { display: none; }. Alternatively #widgets .textwidget a { display: inline-flex; align-items: center } fixes the space and aligns the arrow image as the br tag is ignored inside and initial direction of flex is row.
Unwrapped button: