I'm a newbie in CSS.
I've created a website in Wordpress and I've made a new template page.
Can be found at http://jobboard.jobsbe.be/test/
I've added some CSS to make the page look like I want but there is one thing that I can't find out how to get it work.
When you look at the page you will see that I used a divider, with between the 2 dividers the word "OR".
I've tried everything that I know and found on the internet, but I can't get the word "OR" centered between the two dividers.
Who knows how I can do this?
This is my css:
/**
* The parent theme's CSS is automatically included so there is no need
* to use the #import rule to include the parent theme CSS.
*
* Place Custom CSS Below this.
*/
/**Changing color of links footer*/
.widget--footer a {
color: #7dc246;
}
/**Changing color of menu links*/
.nav-menu--primary ul li a, .nav-menu--primary li a {
color: #7dc246;
}
.nav-menu--primary ul li a:hover, .nav-menu--primary li a:hover {
color: #fff; background-color: #7dc246;
}
/**Changing style Login box*/
.nav-menu--primary ul li.highlight > a, .nav-menu--primary ul li.login > a {
border-style: solid;
border-width: 1px;
border-color: #7dc246;
color: #fff;
background-color: #7dc246;
}
.nav-menu--primary ul li.highlight > a:hover, .nav-menu--primary ul li.login > a:hover {
border-style: solid;
border-width: 1px;
border-color: #7dc246;
color: #7dc246;
}
/**Changing style menu on small screen*/
.primary-menu-toggle:before {
color: #7dc246; background-color: #fff;
}
/**Buttons Signup Page*/
.btn.btn-primary.text-capitalize.m-0 {
border-radius: 5px;
background: #7dc246;
color: #fff;
padding: 15px;
}
.o-or-divider {
color: #7d7d7d;
font-size: 20px;
font-weight: bold;
padding-top: 115px;
text-align: center;
}
*, :after, :before {
box-sizing: border-box;
}
.o-or-divider:before {
top: -10px;
}
.o-or-divider:after, .o-or-divider:before {
position: absolute;
content: "";
display: block;
padding: 55px 0;
border-left: 1px solid #7dc246;
left: 80px;
}
*, :after, :before {
box-sizing: border-box;
}
.o-or-divider:after {
top: 155px;
}
.o-or-divider:after, .o-or-divider:before {
position: absolute;
content: "";
display: block;
padding: 55px 0;
border-left: 1px solid #7dc246;
left: 80px;
}
*, :after, :before {
box-sizing: border-box;
}
The dividers aren't centered properly, just add left:50%; to the before and after:
.o-or-divider:after, .o-or-divider:before {
position: absolute;
content: "";
display: block;
padding: 55px 0;
border-left: 1px solid #7dc246;
left: 50%;
}
In fact it is your :before and :after that aren't centered.
You should had to both of them the following rule:left: 50%;
Since the container of them is already a position: relative; they will be positionned at 50% from the very left of the container.
More infos about positionning in css
Related
I have this code in my CSS file:
.blog-nav li {
position: relative;
display: inline-block;
font-weight: 500;
}
.blog-nav li a {
color: #fff;
position: relative;
display: inline-block;
padding: 10px;
font-weight: 500;
color: #cdddeb;
}
.blog-nav li a:hover,
.blog-nav li a:focus {
color: #fff;
text-decoration: none;
}
I would like to add an arrow like this: https://getbootstrap.com/docs/3.4/examples/blog/.
I tried with this code from the basic template from bootstrap:
/* Active state gets a caret at the bottom */
.blog-nav li a .active {
color: #fff;
}
.blog-nav li a .active:after {
position: absolute;
bottom: 0;
left: 50%;
width: 0;
height: 0;
margin-left: -5px;
vertical-align: middle;
content: " ";
border-right: 5px solid transparent;
border-bottom: 5px solid;
border-left: 5px solid transparent;
}
as i saw from your code, the .active class is not a selector of anchor tag, which means the .active is a child of anchor tag, not state class, i hope i understood you well
so it should be like this
/* Active state gets a caret at the bottom */
.blog-nav li a.active {
color: #fff;
}
.blog-nav li a.active:after {
position: absolute;
bottom: 0;
left: 50%;
width: 0;
height: 0;
margin-left: -5px;
vertical-align: middle;
content: " ";
border-right: 5px solid transparent;
border-bottom: 5px solid;
border-left: 5px solid transparent;
}
read more about selectors
I have a menu that has a nice dropdown and everything, but the only problem I have here is that I can't find a way to move this damn drop down just a little bit to the left so it is directly under its parent tab!! It is always to the side, I see other people's examples and when I add padding between the menu tabs it does the same exact thing! Perhaps it is because of that padding?? (I'm talking about this: http://jsbin.com/gimilapiki/edit?html,css,output)
So, here is my project: https://codepen.io/anon/pen/gxdVdO?editors=1100
Here's some code (because StackOverFlow forces me to):
body {background-color: #E8E8E8;}
ul {list-style: none;}
li {
float: left;
background-color: white;
}
li:not(.search) {padding: 12px 20px 12px 20px;}
li ul {
display: none;
position: absolute;
padding-left: 1px;
padding-top: 12px;
}
a {
text-decoration: none;
color: #5E5E5E;
}
li:not(.search):hover {
color: black;
background-color:#E3E3E3;;
}
ul li ul li {
float: none;
background-color: #E3E3E3;
}
ul li ul li:not(.search):hover {background-color: #D1D1D1;}
li:hover > ul {
z-index: 289;
display: block;
padding: 0 10px 20 20px;
}
.search-input {
width: 150px;
height: 18px;
padding: 0 7px;
border: 1px solid grey;
border-radius: 10px;
border-bottom-right-radius: 0px;
border-top-right-radius: 0px;
}
.search-input:hover {
outline: none;
opacity:0.99;
cursor: pointer;
box-shadow: 0 2px 5px 2px rgba(0, 0, 0, 0.05) inset;
}
input:focus {outline: none;}
#search-icon {
height: 18px;
}
.search {
padding-bottom: 10px;
}
form {
margin-top: 4px;
}
I'm seriously stuck on this simple problem. Adding padding-left or padding-right or margins did nothing, it only affected the vertical height of the tabs and nothing else. I tried everything, researched as much as I can, and nothing worked. Please help!!!
you can add something simple like this
li ul {
display: none;
position: absolute;
padding-left: 1px;
margin-left: -10px;
padding-top: 12px;
}
i added the margin-left: -10px; and i think it works
ul > li{
position: relative;
}
ul > li > ul{
position: absolute;
top: 100%;
left: 0px;
}
try to add this.
Just add position as relative.That will solve your problem.
li ul {
display: none;
position: relative;
padding-left: 1px;
padding-top: 12px;
margin-right:100px;
}
Is there a way, using CSS, to make it so that when clicking a tab (as shown in the diagram below), the tab "points" to an inactive tab?
I'm trying to make it so that the green Tab 1 (in the diagram below) points to Tabs 2 and 3, and then if you click Tab 2, it points to Tab 3. However, when you click Tab 3, it would remain rectangular (with no arrow).
I have been trying various Stack Overflow snippets which successfully place the arrow above or below the tab, but none seem to work in overlapping the inactive tab next to the active tab.
This is the basic structure of my HTML:
<ul>
<li class="active">
Tab 1
</li>
<li>
Tab 2
</li>
<li>
Tab 3
</li>
</ul>
As for the CSS, I've been using snippets like this one: https://codepen.io/mimoYmima/pen/MwzQym
The issue I've been running into seems to be that, because the tabs are floated left, I can't make the active tab's arrow overlap the other tabs.
Just add triangle using pseudoelement to active tab and other to simulate triangle border. Demo:
ul {
list-style-type: none;
display: flex;
margin: 0;
padding: 0;
}
ul > li {
padding: 10px 40px;
font-weight: bold;
font-size: 24px;
height: 40px;
border: 1px solid #000;
border-right: none;
background: linear-gradient(to bottom, #fdfdfd, #828282);
}
ul > li.active {
background: #66d835;
position: relative;
}
ul > li.active:before,
ul > li.active:after {
content: "";
position: absolute;
left: 100%;
top: 0;
}
/* triangle border for active tab */
ul > li.active:before {
transform: translateX(1px);
border: 30px solid transparent;
border-left-color: #000;
z-index: 1;
}
/* triangle for active tab */
ul > li.active:after {
/* border-width equal half of the height */
border: 30px solid transparent;
border-left-color: #66d835;
z-index: 2;
}
/* border-radius for first tab */
ul > li:first-child {
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}
/* border-radius for last tab but not active */
/* and right border */
ul > li:not(.active):last-child {
border-right: 1px solid #000;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}
ul > li > a {
height: 100%;
/* styles for text centering */
display: flex;
align-items: center;
justify-content: center;
}
ul > li > a,
ul > li > a:hover,
ul > li > a:active,
ul > li > a:visited {
color: inherit;
text-decoration: none;
}
<ul>
<li class="active">
Tab 1
</li>
<li>
Tab 2
</li>
<li>
Tab 3
</li>
</ul>
You can leverage a pseudo element with absolute positioning as the arrow for the active tab. It will be hidden unless the list item is given the 'active' tab. Original HTML markup remains untouched.
html,
body {
height: 100%;
margin: 0;
}
html {
font-family: sans-serif;
}
body {
display: flex;
}
ul {
margin: auto;
padding: 0;
display: inline-block;
list-style-type: none;
overflow: hidden;
background-color: #eee;
background-image: linear-gradient( #fff, #ddd);
border-radius: 1rem;
border: 1px #888 solid;
font-weight: bold;
}
li {
float: left;
padding: 1.5rem 4rem;
border-right: 1px #aaa solid;
position: relative;
}
li:last-child {
border: none;
}
a {
text-decoration: none;
color: #000;
}
.active {
background-color: #0b0;
background-image: linear-gradient( #0b0, #090 );
}
li.active::after {
content:'';
width: 3rem;
height: 3rem;
background-color: #eee;
position: absolute;
border: none;
transform: scaleX( 0.75 ) rotate( 45deg ) translate( -50% );
top: 50%;
right: -2.45rem;
margin-top: -0.45rem;
border-top: 1px #888 solid;
border-right: 1px #888 solid;
background-color: #0b0;
background-image: linear-gradient( 130deg, #0b0, #090 );
border-top-right-radius: 0.5rem;
}
<ul>
<li class="active">
Tab 1
</li>
<li>
Tab 2
</li>
<li>
Tab 3
</li>
</ul>
You don't need to float the arrow divs.
I have forked the codepen you linked to and edited the CSS to create the effect in the graphic you've shared. Here's my edited version:
https://codepen.io/sigil/pen/YxWZGa
<!-- language: lang-css -->
/* Button-arrow CSS: */
.arrow {
cursor: pointer;
display: inline-block;
height: 40px;
position: relative;
line-height: 2.5em;
padding-left: 2em;
padding-right: 2em;
background: white;
color: black;
border: 1px solid #eee;
}
.arrow:after {
border-left: 20px solid white;
}
.arrow.active {
background-color: yellow;
}
.arrow.active,
.arrow.active:after {
z-index: 50;
border-left: 20px solid yellow;
}
.arrow.active:after {
content: "";
position: absolute;
border-bottom: 20px solid transparent;
border-top: 20px solid transparent;
height: 0px;
width: 0px;
margin-right: -20px;
right: 0;
}
.arrow:hover,
.arrow:active {
background: yellow;
color: black;
}
.arrow:hover:after,
.arrow:active:after {
border-left: 20px solid yellow;
}
/* General styles to set a baseline 'look' - not related to the button-arrow CSS above */
body, html {
font-family: helvetica;
background: #333;
color: #CCC;
}
.content {
text-align: center;
margin: 0 auto;
}
a:visited, a:link {
color: #F93;
}
<!-- language: lang-html -->
<html>
<body>
<div class="content">
<p>Button with an arrow on the right. Just uses an anchor tag and css, so you can use it with your existing buttons easily by just adding the class of "arrow"! Also includes a hover state.</p>
<a class="arrow active">Arrow</a><a class="arrow">Arrow</a><a class="arrow">Arrow</a>
</div>
</body>
</html>
<!-- end snippet -->
need help with css codes for a border above and below the header like this website : http://www.simpsonmagazine.cc/ . I also want to change the slider height for my site : http://www.etctaylors.com/
CSS codes used so far :
/*
Theme Name: Sight Child
Theme URI: http://example.com/twenty-fourteen-child/
Description: Twenty Fourteen Child Theme
Author: John Doe
Author URI: http://example.com
Template: Sight
Version: 1.0.0
Tags: light, dark, two-columns, right-sidebar, responsive-layout,
accessibility-ready
Text Domain: sight-child
*/
/* =Theme customization starts here
-------------------------------------------------------------- */
.main-navigation {
border-bottom: solid;
border-color: black;
border-width: 3px;
}
.main-navigation li {
text-indent: 5px;
}
.main-navigation ul {
margin-left: auto;
margin-right: auto;
width: 100%;
}
.main-navigation li {
border: none;
}
.main-navigation {
margin-left: 0;
margin-right: 0;
width: 100%;
}
.main-navigation li:hover > a, .main-navigation ul ul :hover > a,
.main-navigation ul ul a:hover {
color: black !important;
text-decoration: none;
}
.main-navigation ul ul, .main-navigation ul li:hover {
background: none;
}
.main-navigation ul ul {
background: none;
}
.main-navigation ul ul a {
color: grey;
}
Try this it will work, I tried it on firebug
.site-header{
border-bottom: 1px solid #000;
border-top: 1px solid #000000;
height: 240px;
padding: 3px 0 3px 0;
position: relative;
}
.site-header:before {
content: '';
border-top: 5px solid #000;
width:100%;
position: absolute;
left:0;
top: 1px;
}
.site-header:after {
content: '';
border-top: 5px solid #000;
position:absolute;
width:100%;
left:0;
bottom:1px;
}
To add a border to your navigation, you can use the following css line:
border-top: 3px solid black;
what do you mean with slider height change?
Here is a Jsfiddle i made
use this for border like the mentioned site to your header css
markup
<div id="top">
<div id="hwrap">
</div>
</div>
you should include your header contents inside hwrap div
css
#top {
width: 940px;
float: left;
border-bottom: 5px solid #222;
border-top: 5px solid #222;
padding-top: 1px;
margin-bottom: 20px;
padding-bottom: 1px;
}
#hwrap {
width: 940px;
float: left;
border-bottom: 1px solid #222;
border-top: 1px solid #222;
padding-top: 20px;
margin-bottom: 0px;
padding-bottom: 20px;
}
DEMO
for changing the slider height in your site
.featured-post {
background: #ffea97;
height:600px; // or your prefered vaklue
}
I am facing some problem with this drop down menu thing. I read your article and it helped me. In the beginning, the drop down worked but when I added some more styling then it stopped working. Other divs and navigation bar is working fine but the drop down menu is not working. Can you please help me pointing out what should be corrected here?
The parent div is nav-bar-left and the style is
.nav-bar-left {
float; left;
overflow: hidden;
width: 980px;
height: 26px;
background-color: Lavender;
border: 1px solid MidnightBlue;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
The navigation div is #horizontalmenu which resides within the above parent div and the style is
#horizontalmenu {
width: 733px;
margin: 0;
position: relative;
float: left;
padding: 0;
}
Rest of the styling for navigation bar is
#navbar {
list-style-type: none;
margin: 0;
width: 100%;
padding: 0;
position: relative;
display: inline-table;
height: 26px;
z-index: 5;
}
#navbar li {
float: left;
position: relative;
}
#navbar a:link, #navbar a:visited {
display: block;
color: #333;
background-color: lavender;
text-align: center;
padding: 6px 10px;
border-style: solid;
border-color: MidnightBlue;
border-width: 0 1px 0 0;
text-decoration: none;
font-size: 14px;
line-height: 14px;
}
#navbar a:hover, #navbar a:active {
color: #fff;
background-color: #6b0c36;
text-decoration: underline;
}
#navbar ul {
left:-9999px;
list-style-type: none;
margin: 0;
padding: 0;
position: absolute;
}
#navbar ul li {
float:none;
border-style: solid;
border-color: Lavender;
border-width: 0 1px 1px 1px;
}
#navbar ul a {
white-space: nowrap;
}
#navbar li:hover ul {
left: 0;
}
#navbar:hover a {
text-decoration: none;
}
#navbar li:hover ul a {
text-decoration: none;
background-color: Lavender;
color: #333;
}
#navbar li:hover ul li a:hover {
background-color: Lavender;
color: #333;
}
So, why is it not working and what can be done?
I found this menu CSS one of my best collection for dropdown menu:
Create a Multilevel Dropdown menu with CSS and improve it via jQuery
And you can find a backup of those codes here in my pastebin.