I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
Its difficult to help without all the code being provided, the HTML is also needed if anyone is to use your code to find solutions/bugs.
You do not have to send all code, but you should send anything you think necessary for others to see the problem your having and try things out on their machines.
I can only guess how you’ve structured your HTML or what it contains.
But I believe your looking for some kind of flexbox layout.
Here is an example of how your code can be changed to include flexbox.
This is the HTML I used to test:
Where is the html code? You need to add three back ticks in a separate line below and above the code block.
Here’s the back ticks within the parentheses ( ```)
Guided, your solution kind of works. It centers the tabs but not completely. The right margin is larger than the left one. The 2 margins a different color.
The code that was posted doesn’t do anything to the padding or margin. The space could also come from an outer container (what the nav/tabs are inside).
Learn to use the browser dev tools to inspect the styles.
Please post all your code. The code you have posted does not look like what is in that image. Include the HTML and CSS for what the tabs are inside (their outer containers).
Your initial styles had different padding values for the left/right padding. Remember, the padding shorthand is top/right/bottom/left (clockwise).
Remove all use of float and switch to using flexbox or grid instead.
The backslash hack you have is ancient, no one uses those systems or browsers it was meant for. If you copied the code, I would suggest you find a newer example. You can keep the colors, but ditch the layout.
OK guys, I’ve centered it now.
Does anybody have a suggestion how I can get the active tab highlighted? I’m assuming it has to be some java script but I know nothing about that. Any help would be greatly appreciated.