Align element next to currently chosen menu item - html

I tried to find a solution to this problem, but failed (maybe I my searching skills are just horrible). Basically, here is the webpage http://www.eboxlab.net/transbeam/our-solutions/data-and-internet-services/.
There are two menu items here, in the first box you see the link "Data and Internet Services is chosen" and the second box is just three elements behaving like anchors. Right now, those are aligned next to the top element in the first level menu (Data and Internet Services). What I need to achieve is that when you choose another option (VoIP and Voice Services for example) the second box moves next to it. So it's aligned depending on the active link in the first menu. I am pretty sure this can be achieved with javascript, but I am really bad at it.
PS: Although I am bad at JS feel free to use all the terms, I will do my research later, just need the code and a little explanation behind it, so in the future I will be able to do this myself.
May be setting a margin to the right box if a certain element in the left one is chosen.

Firstly, there is solution for your webpage, but it cannot be done via JavaScript.
JavaScript can do things like what you thought, but note that it only works on the same page. It means that when user click somewhere, and still remains on the same page, JavaScript can do many things, like change the DOM structure, change style of something, or do some animation. But if the page is redirected to another page, that's different.
[Solution for your webpage]
On the page for item "VoIP and Voice Services" (http://www.eboxlab.net/transbeam/our-solutions/voip-and-voice-services/), add following CSS to your page file:
#banner .left_box .box-2 {
margin: -10px 0 0 20px;
}
For other items, it would be similar to change the margin to adjust its position (vertically position):
Page of "Cloud Services"
#banner .left_box .box-2 {
margin: 30px 0 0 20px;
}
Page of "Integrated Voice and Data Services"
#banner .left_box .box-2 {
margin: 70px 0 0 20px;
}
Page of "Additional Data and Voice Features
#banner .left_box .box-2 {
margin: 110px 0 0 20px;
}
Or you can just change "margin-top", both work.
/* Following part added at 15:08 Oct 28, GMT+8 */
[Solution for webpage with Template]
1. In the template file, change this line
<div class="box-2">
to
<div class="box-2-{$item}">
Note: {$item} is variable format of Smarty, you may change this to your own template's format.
2. In each page, assign an identical value to this variable, you will do something like:
$smarty->assign('item','item1'); //assign item2, item3 to the other two pages.
3. In Style file ("transbeam/wp-content/themes/transbeam/style/style.css"), add following lines:
#banner .left_box .box-2-item1 {
background:url(../images/sep_1.png) no-repeat left;
float:left;
height:163px;
margin:-50px 0 0 15px;
}
#banner .left_box .box-2-item2 {
background:url(../images/sep_1.png) no-repeat left;
float:left;
height:163px;
margin:-10px 0 0 15px;
}
#banner .left_box .box-2-item3 {
background:url(../images/sep_1.png) no-repeat left;
float:left;
height:163px;
margin:30px 0 0 15px;
}
This should work, hope to help you out.

Related

Button is aligning to the left when using max-width

This is my first post here. I'm trying to customize a button of "Add to wishlist"/ "It's already in wishlist" text in it to a website for a client, and that button is found in 2 separate pages. It's a website I made in Wordpress and Elementor mostly, but I have to customize that button myself because I can't do it from Wp/Elementor.
I've used this code to customize that button:
.tinvwl-loop-button-wrapper{
background-color: #222529 !important;
padding: 4px 5px 4px 4px !important;
margin: 10px 25px 0px 25px !important;
font-size: 14px !important;
border-radius: 3px !important;
font-weight: 600;
}
The problem is that in the Product page the button looks well in Related Products (Produse Similare in Romanian language) section of the page, but in the Shop page (called Magazin in Romanian) the button has too much space left and right of the text.
I noticed that the buttons share the same classes in both pages, so if I add something like max-width: 160px; then the button goes far to the left in Shop page, and adding margin-left to it won't work because then it ruins the button on the other page. What can I do to remove all that space left and right inside of the button and have the button similar to the "Read more" (Citeste mai mult) or "Add to cart" (Adauga in cos) buttons?
PS. I know I used too much the !important rule. It's my first ever website where I'm using CSS and removing the rule from all the code could potentially ruin it all I think and I'd have to start from scratch.
Product page
Shop page
You can add a separate class for one of the buttons where you set the margins you need.
Simple replace with it, it will working fine
.tinvwl-loop-button-wrapper {
margin: 10px 41px 0px 41px !important;
}
The problem is the background color is set to the button wrapper in loop page.
.tinvwl-loop-button-wrapper {
background-color: #222529 !important;
}
you need to remove the above css line and add it to the button itself.
.tinvwl_add_to_wishlist_button {
background-color: #222529 !important;
}
you will need to add some padding then to the button. There are many !important statements overriding each others. you will need to adjust that, It will be much harder to fix later by adding more.
Hi George I checked the links you have provided.
You need to use a parent class that exist in Shop page but not in related products which in your case is .wcpa_has_options and you need to combine this with the button class that you are trying to resize > .tinvwl-loop-button-wrapper
at the end you will get this class combination which will only change the button size on shop pages.
.wcpa_has_options .tinvwl-loop-button-wrapper {
width: 152px;
align-self: center;
}
I have tested it and it works just the way you want!
Glad to be help. Let me know if you have questions.

Customize WordPress CSS on top of an existing Theme

I have installed a theme in my WordPress website.
On top of the theme, I have added bbPress (forum)... unfortunately the CSS render very badly the forum features...
for example, the picture below show how the search button overlap with the search box
Search box-button overlapping
If I look at the css I can see this:
element.style {
}
vlog-bbpress.css?ver=1.8.1:9
#bbpress-forums #bbp-search-form {
position: relative;
float: none;
}
bbpress.css?ver….5.14-6684:429
#bbpress-forums #bbp-search-form {
clear: left;
}
what should I change in the css??? (I have installed Simple Custom CSS plugin (https://en-ca.wordpress.org/plugins/simple-custom-css/)so I should not need to do any custom css, but I shoul just be able to add the custom CSS)
in case anyone of you want to have a look at the website, you can find it here (not live yet, just playing around)
http://italiancrypto.it/forums/
many thanks all
Regards
#bbpress-forums #bbp-search-form .button {
margin-top:0;
}
#bbpress-forums #bbp-search-form #bbp_search {
height: 42px;
}
You may need to include !important tags, depending on where your CSS overrides are injected. But only use if necessary.
eg:
#bbpress-forums #bbp-search-form .button {
margin-top:0 !important;
}
#bbpress-forums #bbp-search-form #bbp_search {
height: 42px !important;
}
Add the below CSS to solve alignment of button
#bbpress-forums #bbp-search-form .button {
margin: 0;
padding: 9px 20px;
}
Do some reading on using the Chrome inspect screen--I've added an image to help. To get this screen, right click on the search button.
You'll see the highlighted html code on the left (the input field). On the right, you'll see the css and their values for that field.
See the check mark next to each field>? I clicked on the margin setting to remove it. Then, I clicked on the plus sign in the upper right of the inspect screen.
That lets you key in a temporary value for a new parameter. I keyed in:
margin-top: 0;
You'll see that in the image I attached. Now the button is aligned. The css to place in your style sheet is just above the inserted margin-top field.
You'll see that the button is now aligned with the search field. So Mando's answer should work.
position: relative. That should work

H1 and site content disappearing through banner as if they have a negative top margin

I'm a bit of a newbie to programming so posting on here to find some help.
Had a quick question which I'm assuming is easily resolved through custom CSS.
If you check out this post on my WP site you will see the content disappearing through the header.
Can someone please advise what piece of CSS has made this happen and what element I need to alter to set a regular margin?
Thank you,
The line that is causing you trouble is this one:
h1.entry-title { /*spacing to position entry title dimensions & font styles*/
margin:-2em 0em 0.5em 1.5em;
text-decoration: none;
font-size:2.8em;
display:block;
position:relative;
color:#474747;
}
It comes from a blog css file as "http://www.beendorsed.com.au/blog?sccss=1&ver=4.3.1".
In that line, when you comment out the line "margin:-2em 0em 0.5em 1.5em;" (like this: "/* margin:-2em 0em 0.5em 1.5em; */"), all will go back to normal.
To add that style to one set of pages only ("blog posts", for instance):
If you need that margin on one page, or one set of pages (like blog posts), add a class to it, like .post, and in the css file add it too, like this:
.post h1.entry-title { /*spacing to position entry title dimensions & font styles*/
margin:-2em 0em 0.5em 1.5em;
text-decoration: none;
font-size:2.8em;
display:block;
position:relative;
color:#474747;
}
When you add posts (instead of pages), you'll see that the articles are classed as ".post" (probably), just like the ones you are currently seeing are ".page". (I'm guessing the class name. Test it, see what the actual class name is, and use that). Here you have the line that states that class:
<article id="post-21" class="post-21 **page** type-page status-publish hentry">
Try to modify margin value in you .post declaration.
.post {
max-width: 640px;
margin: 130px auto 0px auto;
font-size: 16px;
}
Line 1804 in your style.css file
If you want to apply this just to on, specific page then do:
#post-104 .post {
margin-top: 130px;
}
You could change the #primary definition to be
#primary {
float: right;
width: 66.6666%;
margin-top: 100px
}
adding the margin-top there. You should get used to identifying the elements in a debug session in the browser to help you understand which element you are targeting.
Note that as I went through your CSS, I saw that you have some merge artifacts in the CSS, things like
>>>>>>> Another_Merge_test
which are not helping things for you.

Site not appearing as it does on my computer

I've made a simple intro website to my site, simply with the buttons 'Media' and 'Share' and a background. On my PC, when I run the site it appears exactly how I would like it to, however when I run it from my site's server (or JSFiddle) the second button doesn't appear. The image is on the server in the correct location.
#first {
margin: 0 auto;
margin-top: 5%;
text-align: center;
}
#second {
margin: 0 auto;
margin-top: 10%;
text-align: center;
}
https://jsfiddle.net/4cg2k722/1/ - Second button doesn't appear. (also appears like this on the server)
https://gyazo.com/6031a7b8c768120b8d7f4adb3e439e20 - How it appears on my PC.
I am using the same browser when I try both.
EDIT: When you load the page from the website, for a split second you see the icon of an unloaded image. before disappearing.
You had a typo in your HTML code. You were missing the closing " in your second <img> tag. The code should be <img src="http://i.imgur.com/4ZCrEHW.png">.
seem that you miss the location of your pictures. http:/asscave.co.uk/wallpaper.jpg do not reach; same for the 2 other pictures http://asscave.co.uk/media.png and http://asscave.co.uk/share.png.
check the link by copy and paste it in browser seperately. If it appears in your browser it must appear also on your Web page.
try to improve your CSS like this
html,body {
width:100%;
height:100%; //no need to specify
background-image:url(https://i.gyazo.com/6031a7b8c768120b8d7f4adb3e439e20.png)
margin: 0 auto;
text-align: center;
}
#first {
//set the width and float it
margin-top: 5%;
}
#second {
margin-top: 10%; //why 10px as margin-top?
//set the width and float it
}

How to center pagination?

You can view the page I'm working on here: http://stats.escalatehosting.com/whois.php
The problem I'm having is that I just can't figure out what CSS needs to be changed to center the page numbers located at the top and bottom of the page. I've tried changing everything I can think of but it always ends up off-center when you start clicking to pages with larger numbers...
I'm not really sure what needs to be changed, if anyone has any suggestions, that would be greatly appreciated.
As you commented, center is not a valid value for float property, either you can use left, right or none which is default.
On creative2tables line 167 change your CSS as provided below..
#ct1_pager_container, #ct2_pager_container {
margin-bottom: 15px;
clear: right; /* Not sure if required */
width: 300px;
}
And in the same stylesheet on line 174 change the below as
#ct1_pager, #ct2_pager {
clear: both;
list-style: none;
}
I've changed the above properties to center your pagination, please do check if you are using these id's for any other element as well.
You need to update below Class.
#ct1_pager_container, #ct2_pager_container{
width:100%;
}
#ct1_pager, #ct2_pager{
float:none;
text-align:center;
}
Update only given element. don't update whole CSS. keep everything else as it is.