I've done quite a bit of searching on here and on google, but I'm having difficulty in finding what the problem is with my hover style on my link.
I'm changing out what used to be a form box into what is not just going to be a link to a landing page. I have changed my text to a link (see html below) and
essentially what's happening is the link is a permanent purple color (see picture).
HTML
<section class="get-started">
<div class="shadow"></div>
<div class="background"></div>
<div class="inner">
<h3>Contact us today to schedule a demo. <span class="fa fa-arrow-circle-right"></span></h3>
<?php// echo do_shortcode('[form]'); ?>
<script type="text/javascript">
// jQuery(window).ready(function($){
// var form = $('form');
//$('.submit-button').click(function(){
//form.submit();
// });
// });
</script>
</div>
</section>
CSS
section.get-started {
position: relative;
}
.get-started a.view_more {
display: inline-block;
color: #dfdfdf;
transition: color .15s ease;
font-size: 22px;
text-align: center;
text-decoration: none;
}
#media(min-width: 1435px){
.get-started a.view_more {
display: inline-block;
padding: 0 0 0 15px;
vertical-align: middle;
}
}
#media(max-width: 1435px){
.get-started a.view_more {
display: block;
padding: 15px 0;
}
}
.get-started a.view_more:hover {
color: #FFB547;
}
.get-started .view_more span {
display: block;
font-size: 50px;
margin: 0 0 10px 0;
}
.get-started div.shadow {
width: 100%;
height: 50%;
background-color: white;
position: absolute;
top: 0;
left: 0;
z-index: 1;
box-shadow: 0px 5px 5px 0px rgba(0, 0, 0, 0.05);
}
.get-started div.background {
width: 100%;
height: 50%;
background-color: #f7f7f7;
position: absolute;
bottom: 0;
left: 0;
}
.get-started div.inner {
background-color: #FFB547;
overflow: visible;
position: relative;
z-index: 2;
box-shadow: 1px 2px 10px 0px rgba(0, 0, 0, 0.2);
}
#media(min-width: 900px){
.get-started div.inner {
padding: 120px 50px;
height: 220px;
}
}
#media(max-width: 900px){
.get-started div.inner {
padding: 10% 5%;
}
}
.get-started div.inner:before {
content: '';
position: absolute;
right: 100%;
top: 0px;
width: 0px;
height: 0px;
border-top: 460px solid transparent;
border-bottom: 0 solid transparent;
border-right: 200px solid #e5a340;
z-index: -1;
}
.get-started h3 {
font-weight: 300;
margin: 0 0 15px 0;
text-align: center;
color: white;
}
#media(min-width: 500px){
.get-started h3 {
font-size: 50px;
}
}
#media(max-width: 500px){
.get-started h3 {
font-size: 36px;
}
}
.get-started h4 {
text-align: center;
font-weight: 300;
color: white;
font-size: 24px;
margin: 0 0 60px 0;
}
.get-started form {
text-align: center;
}
.get-started form input[type="text"],
.get-started form input[type="email"] {
background-color: transparent;
outline: none;
border: none;
border-bottom: 2px solid rgba(255,255,255,.6);
font-size: 24px;
padding: 0 0 2px 5px;
color: white;
vertical-align: middle;
font-weight: 300;
border-radius: 0;
}
#media(min-width: 1000px){
.get-started form input[type="text"],
.get-started form input[type="email"] {
width: 200px;
display: inline-block;
margin: 0 20px 0 0;
}
.get-started form input[type="email"] {
width: 350px;
}
}
#media(max-width: 1000px){
.get-started form input[type="text"],
.get-started form input[type="email"] {
width: 100%;
max-width: 400px;
display: block;
margin: 0 auto 20px auto;
}
}
.get-started form input[type="text"]::placeholder,
.get-started form input[type="email"]::placeholder {
color: rgba(255,255,255,.6);
}
.get-started form input[type="text"]:-ms-input-placeholder,
.get-started form input[type="email"]:-ms-input-placeholer {
color: rgba(255,255,255,.6);
}
.get-started form input[type="submit"] {
display: none;
}
.get-started form span.fa {
color: white;
font-size: 50px;
position: relative;
top: 10px;
right: 5px;
cursor: pointer;
opacity: .6;
transition: opacity .15s ease;
}
.get-started form span.fa:hover {
opacity: 1;
}
I tried to change the class of the link to view_more it changes to the below image
<div class="inner">
<h3><a class="view_more" href="#">Contact us today to schedule a demo. <span class="fa fa-arrow-circle-right"></span></a></h3>....
But this still isn't the exact style I want, so I think that just changing the classes will work, right?
So I change the class to view_more_optin and add the following CSS:
<div class="inner">
<h3><a class="view_more_optin" href="#">Contact us today to schedule a demo. <span class="fa fa-arrow-circle-right"></span></a></h3>....
.get-started a.view_more_optin {
display: inline-block;
color: #dfdfdf;
transition: color .15s ease;
font-size: 22px;
text-align: center;
text-decoration: none;
}
#media(min-width: 1435px){
.get-started a.view_more_optin {
display: inline-block;
padding: 0 0 0 15px;
vertical-align: middle;
}
}
#media(max-width: 1435px){
.get-started a.view_more_optin {
display: block;
padding: 15px 0;
}
}
.get-started a.view_more_optin:hover {
color: #FFB547;
}
.get-started .view_more_optin span {
display: block;
font-size: 50px;
margin: 0 0 10px 0;
}
But alas, I get a result of the original picture!
What is overruling my new classes that I am making?
It looks like you're in fact asking quite a basic question. You may have a lot of code there from the theme, and perhaps got a bit lost in it.
The best way to control the style of the link is to add a class to it, and then style that class. Below you can see an example of adding the .contact-link class to the anchor element, and then styling it. I hope it helps!
/* this line is only for this example, ignore it */
body {
background-color: seagreen;
}
/* add these lines below to the end of your stylehseet */
a.contact-link,
a.contact-link:visited {
color: white;
}
a.contact-link:hover {
color: blue;
}
<section class="get-started">
<div class="shadow"></div>
<div class="background"></div>
<div class="inner">
<h3><a class="contact-link" href="#">Contact us today to schedule a demo. <span class="fa fa-arrow-circle-right"></span></a></h3>
</div>
</section>
Related
This is how my code looks like
function myFunction() {
var x = document.getElementById("leftsidebar");
if (x.className === "navbar") {
x.className += " responsive";
} else {
x.className = "navbar";
}
}
body {
padding-top: 5px;
background: #efefef;
color: #000;
font: 10pt/18pt Arial, sans-serif;
border-top: 6px;
}
#navbar {
max-width: 928px;
font-size: 22px;
background: #FFF;
box-shadow: 0 0 20px #CCC;
border: 1px solid #ccc;
zoom: 1;
margin: 0 auto 10px;
padding: 10px;
font-size: 2em;
font-weight: bold;
background-color: #4596d8;
margin-bottom: -4px;
}
#content {
display: flex;
max-width: 946px;
background: #FFF;
box-shadow: 0 0 20px #CCC;
border: 1px solid #ccc;
zoom: 1;
margin: 0 auto 10px;
font-size: 2em;
font-weight: bold;
margin-bottom: -4px;
background: #FFF;
}
#leftsidebar {
width: 200px;
border-right: 2px solid #4596d8;
}
#leftsidebar ui a {
display: block;
font-size: 18px;
color: black;
width: 100%;
padding-left: 10px;
padding-top: 10px;
box-sizing: border-box;
border-top: 1px solid red rgba(255, 255, 255, .1);
border-bottom: solid 1px;
text-decoration: none;
}
#leftsidebar ui a:hover {
background-color: #4596d8;
}
#maincontent {
width: 728px;
padding: 10px;
padding-top: 5px;
font: 10pt/18pt Arial, sans-serif;
}
h1 {
display: block;
font-size: 2em;
font-weight: bold;
border-width: 6px;
}
div {
display: block;
}
#container {
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: 0 0;
padding: 0;
}
table {
margin-left: 20%;
margin-right: 20%;
border: 1px solid #4596d8;
}
form {
margin-left: 0 auto;
margin-right: 0 auto;
}
#footer {
text-align: center;
margin: 0 auto;
}
.form-inline {
flex-direction: column;
align-items: stretch;
}
#media screen and (max-width: 600px) {
.leftsidebar a:not(:first-child) {
display: none;
}
.leftsidebar a.icon {
float: right;
display: block;
}
}
#media screen and (max-width: 600px) {
.leftsidebar.responsive {
position: relative;
}
.leftsidebar.responsive .icon {
position: absolute;
right: 0;
top: 0;
}
#navbar.responsive a {
float: none;
display: block;
text-align: left;
}
}
<div id="navbar">
MySite
</div>
<div id="content">
<div id="leftsidebar">
<ui>
Site1
Site2
Site3
<a href="site4.html" class="w3-bar-item w3-button">Site4/a>
Site5
</ui>
</div>
When I resize my site everything stays the same, nothing changes. I changed the lines so many times and nothing changed. Besides this problem everything else I could solve on my own.
My code is from this example. The only difference from the example site is, that my websites navbar is on the left and my logo in in the top navbar. So when I resize it or am on a certain width the menu elements are in the navbar hidden behind a icon.
You where using the .leftsidebar selector (class selector) instead of #leftsidebar the ID selector. The element doesnt have a class so you have to use #leftsidebar
function myFunction() {
var x = document.getElementById("leftsidebar");
if (x.className === "navbar") {
x.className += " responsive";
} else {
x.className = "navbar";
}
}
body {
padding-top: 5px;
background: #efefef;
color: #000;
font: 10pt/18pt Arial, sans-serif;
border-top: 6px;
}
#navbar {
max-width: 928px;
font-size: 22px;
background: #FFF;
box-shadow: 0 0 20px #CCC;
border: 1px solid #ccc;
zoom: 1;
margin: 0 auto 10px;
padding: 10px;
font-size: 2em;
font-weight: bold;
background-color: #4596d8;
margin-bottom: -4px;
}
#content {
display: flex;
max-width: 946px;
background: #FFF;
box-shadow: 0 0 20px #CCC;
border: 1px solid #ccc;
zoom: 1;
margin: 0 auto 10px;
font-size: 2em;
font-weight: bold;
margin-bottom: -4px;
background: #FFF;
}
#leftsidebar {
width: 200px;
border-right: 2px solid #4596d8;
}
#leftsidebar ui a {
display: block;
font-size: 18px;
color: black;
width: 100%;
padding-left: 10px;
padding-top: 10px;
box-sizing: border-box;
border-top: 1px solid red rgba(255, 255, 255, .1);
border-bottom: solid 1px;
text-decoration: none;
}
#leftsidebar ui a:hover {
background-color: #4596d8;
}
#maincontent {
width: 728px;
padding: 10px;
padding-top: 5px;
font: 10pt/18pt Arial, sans-serif;
}
h1 {
display: block;
font-size: 2em;
font-weight: bold;
border-width: 6px;
}
div {
display: block;
}
#container {
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: 0 0;
padding: 0;
}
table {
margin-left: 20%;
margin-right: 20%;
border: 1px solid #4596d8;
}
form {
margin-left: 0 auto;
margin-right: 0 auto;
}
#footer {
text-align: center;
margin: 0 auto;
}
.form-inline {
flex-direction: column;
align-items: stretch;
}
#media screen and (max-width: 600px) {
#leftsidebar a:not(:first-child) {
display: none;
}
#leftsidebar a.icon {
float: right;
display: block;
}
}
#media screen and (max-width: 600px) {
#leftsidebar.responsive {
position: relative;
}
#leftsidebar.responsive .icon {
position: absolute;
right: 0;
top: 0;
}
#navbar.responsive a {
float: none;
display: block;
text-align: left;
}
}
<div id="navbar">
MySite
</div>
<div id="content">
<div id="leftsidebar">
<ui>
Site1
Site2
Site3
<a href="site4.html" class="w3-bar-item w3-button">Site4/a>
Site5
</ui>
</div>
Your code has a lot of bugs. Firstly the ui (unordered list) has to have li as it children. Anything besides an li as a ui child is a bug. Though you can have your link inside li you cannot have it as child of ui directly. If you put value 0 as border it doesn't work and is a bug. You should value it as none instead of 0 so border: none; the same with background padding and outline it should have a value of none.
Margin cant be both 0 and auto just say auto instead of 0 auto. You should also see some actual code of others. You are using code like english not like computer you have used a lot uneccesary css properties. Watch others coding youtube. You can use padding and margin the best way instead of writing padding left padding top. Just use thus syntax: padding: top right bottom left;
For example padding: 0 9px 0 9px;
For your media queries search on internet and use #media only screen and (max-width: 600px) {} device that has 600 px width like a mobile
Dont use the same value use a different value.
#media only screen and (max-width: 900px) {} this implements on a 900px width device like tablet.
I have a site and it has 2 sections. the left section is a navigation bar with menus below.
The section next to it is the main section or where the website content must be placed. My problem is the right section is positioned a few pixels from the header. How can i fix this? I provided some image to let you see how the website should look like.
/*WRITTEN USING SASS*/
#side-menu{
margin-top: 25px;
.side-menu-bg {
width: max-content;
h3 {
position: absolute;
color: white;
padding: 0px 18px;
font-size: 27px;
}
img {
display: -webkit-box;
}
}
.side-nav-bar {
width: 210px;
position: unset;
margin-top: -3px;
display: inline-flex;
z-index: 1;
flex-direction: column;
overflow-x: hidden;
background-color: #ffffff;
a {
display: inherit;
color: #707070;
text-decoration: none;
font-size: 15px;
padding: 10px 18px;
position: relative;
border-bottom: 1px solid #e8e8e8;
}
.active-link{
color: #a40022;
border-bottom: 2px solid #8a001c;
}
}
.right-contents {
float: right;
.title h3 {
font-size: 38px;
}
.body-content {
background-color: #d3d3d3;
height: 1094px;
width: 738px;
}
}
}
<div class="wrapper"> <!--to make contents center-->
<div id="side-menu">
<div class="side-menu-bg">
<h3>KU 스타트업</h3>
<img src="images/bg/bg_03.png">
</div>
<div class="side-nav-bar">
인사말
창업 비전
창업 프로세스
창업부서소개
찾아오시는 길
</div>
<div class="right-contents">
<div class="title">
<h3>인사말</h3>
<div class="body-content">
sample text
</div>
</div>
</div>
</div>
</div>
Add margin: 0 to your h3 tag.. h3 has margin-to and margin-bottom by default. thanks
.right-contents {
float: right;
.title h3 {
font-size: 38px;
margin: 0; /*add this*/
}
.body-content {
background-color: #d3d3d3;
height: 1094px;
width: 738px;
}
<style>
/*WRITTEN USING SASS*/
#side-menu{
margin-top: 25px;
.side-menu-bg {
width: max-content;
h3 {
position: absolute;
color: white;
padding: 0px 18px;
font-size: 27px;
}
img {
display: -webkit-box;
}
}
.side-nav-bar {
width: 210px;
position: unset;
margin-top: -3px;
display: inline-flex;
z-index: 1;
flex-direction: column;
overflow-x: hidden;
background-color: #ffffff;
}
a {
display: inherit;
color: #707070;
text-decoration: none;
font-size: 15px;
padding: 10px 18px;
position: relative;
border-bottom: 1px solid #e8e8e8;
}
.active-link{
color: #a40022;
border-bottom: 2px solid #8a001c;
}
}
.right-contents {
width: 65%;
margin-top: -3px;
display: inline-flex;
.title h3 {
font-size: 38px;
}
.body-content {
background-color: #d3d3d3;
height: 1094px;
width: 738px;
}
</style>
I can't get an element to go where I want it to. I am only having this problem because of the way I did my header. I applied position: absolute. You can see an example here: http://jacobgasser.com and you can find all the code on there, or you can read down a little farther and I put it there.
I want the text in the top left of the page to be on the white part of the page
Here is the index.html
<body onload="loadUp();">
<div class="menu">
<a href="https://github.com/jacobgasser" target="_blank"><div
class="menuItem">Projects</div></a>
</div>
<div class="titleBG">
<h1 class="title" onmouseover="coolThing();"onmouseout="notCoolThing();">Jacob Gasser</h1>
</div>
<div class="article">
<div class="articleHead">Who am I?</div>
</div>
<script src="scripts/main.js"></script>
</body>
Here is main.css
body {
margin:0;
padding:0;
}
.title {
color: white;
text-align: center;
font-size: 1000%;
opacity: 0;
-webkit-transition: 0.2s;
}
a {
text-decoration: none;
color: inherit;
}
.article {
font-family: "Arial";
display: inline-block;
padding: 5px 10px 5px 10px;
margin: 5px 10px 5px 10px;
text-align: center;
position: relative;
}
.articleHead {
display: inline-block;
padding: 5px 10px 5px 10px;
margin: 5px 10px 5px 10px;
}
.menu {
display: block;
color: white;
float: right;
margin-right: 10px;
margin-top: 5px;
opacity: 0;
}
.menuItem {
font-size: 400%;
display: block;
padding-left: 20px;
padding-right: 20px;
-webkit-transition: 0.2s;
border-radius: 5px;
}
.menuItem:hover {
background-color: white;
color: black;
cursor: pointer;
-webkit-transition: 0.2s;
}
.titleBG {
background-color: #23272A;
display: block;
width: 100%;
z-index: -1;
position: fixed;
top: 0;
}
::selection {
color: #23272A;
background-color: white;
}
::-moz-selection {
color: #23272A;
background-color: white;
}
#font-face {
font-family: lemon;
src: url("fonts/LemonMilk.otf");
}
#font-face {
font-family: cavs;
src: url("fonts/CaviarDreams.ttf");
}
A simple solution to this issue is to remove the position: fixed; top: 0; and adjust the margin-top and margin-bottom of the page. Just change the CSS for .titleBG and .title to be the following:
.titleBG {
background-color: #23272A;
display: block;
width: 100%;
z-index: -1;
}
.title {
color: white;
text-align: center;
font-size: 1000%;
opacity: 0;
-webkit-transition: 0.2s;
margin: 0 /* You can add a margin-left or margin-right if you want, or even margin-bottom, just keep the margin-top at 0*/;
}
This will give you the following result:
HTML:
<div class="menu-panel">
<h3>Table of Contents</h3>
<ul id="menu-toc" class="menu-toc">
<li>Home</li>
<li style="border-top: #FFF solid 1px;" class="menu-toc-current">Biography</li>
<li>Extra Curricular</li>
<li>Favorites</li>
</ul>
</div>
<div class="main">
<h2>Biography</h2>
<p>THIS INFO SHOWS UP WITH HEAVY CSS EDITING</p>
</div>
CSS:
.menu-panel {
background: #013E7D;
width: 240px;
height: 100%;
position: fixed;
z-index: 1000;
top: 0;
left: 0;
text-shadow: 0 1px 1px rgba(0,0,0,0.1);
margin: 0px;
}
.menu-panel h3 {
font-family:Roboto;
font-size: 1.8em;
padding: 20px;
font-weight: 300;
color: #fff;
box-shadow: inset 0 -1px 0 rgba(0,0,0,0.05);
}
.menu-toc {
list-style: none;
}
.menu-toc li a {
font-family:Roboto;
display: block;
color: #C0C0C0;
font-size: 1.1em;
line-height: 3.5;
padding: 0 20px;
cursor: pointer;
background: #013E7D;
border-bottom: 1px solid #FFF;
}
.menu-toc li a:hover,
.menu-toc li.menu-toc-current a {
background: #000000;
}
.menu-panel div {
margin-top: 20px;
}
.menu-panel div a {
text-transform: uppercase;
font-size: 0.7em;
line-height: 1;
padding: 5px 20px;
display: block;
border: none;
color: #bc0b0b;
letter-spacing: 1px;
font-weight: 800;
text-shadow: 0 1px rgba(255,255,255,0.2);
}
#media screen and (max-width: 800px) {
.no-js .menu-panel {
display: none;
}
.no-js .container {
padding: 0;
}
#media screen and (max-width: 400px) {
.menu-panel,
.content {
font-size: 75%;
}
.main {
margin-left:797px;
position:fixed;
font-family:Roboto;
}
So basically I need to get the table of contents to be static so all other elements go around it!! I have been trying to fix this and it will not work. If you could help me it would help a lot! Thank you
.menu-panel {
background: #013E7D;
width: 240px;
height: 100%;
z-index: 1000;
top: 0;
left: 0;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
margin: 0px;
float: left;
}
in css removing the position and adding the float results in horizontally aligned blocks. see also http://codepen.io/anon/pen/XXJRWx
I am able to display two span text elements over the image when I hover over with my cursor successfully. But I am having trouble placing a button that is centered over the image, below the project name. Any help would be appreciated. I should also note the button that I want to use is from a Bootstrap 3 class.
Here is a demo: https://jsfiddle.net/oo1xx006/3/
Here is an example of what I want to create: http://www.devonstank.com/
HTML:
<div class="latest_projects">
<!-- My latest projects -->
<h1>My latest projects</h1>
<br>
<ul class="projects-list">
<li>
<img src="img/mudmat-global-model.jpg" alt="DOF Mudmat Lowering" width="380px" height="380px"/>
<span class="text-content">
<span class="project-type"><i>Project Type</i></span>
<span class="project-name">Project Name</span>
<!-- <span>View project</span> -->
</span>
</li>
</ul>
<br>
View more projects
</div>
CSS:
body {
padding-top: 0;
font-family: 'PT Sans', sans-serif;
background-color: white;
}
h1 {
/* margin: 15px 0;*/
font-size: 1.9em;
font-weight: normal;
color: #000;
line-height: 120%;
text-align: center;
}
h2 {
font-size: 1.3em;
margin: -5px 0 0;
font-weight: normal;
color: #000;
text-align: center;
}
a {
text-decoration: none;
color: #000;
font-weight: bold;
}
a:hover {
text-decoration: none;
}
p {
line-height: 200%;
padding: 0 10% 0 10%;
font-size: 1.1em;
text-align: center;
}
.btn-default {
border-color: #000;
border-radius: 0;
border-width: 2px;
color: #000;
font-size: 1.5em;
}
.btn-default:hover {
color: #fff;
background-color: #000;
border-color: #000;
border-radius: 0;
border-width: 2px;
}
img {
max-width: 100%;
}
/************************************
HOME
************************************/
.latest_projects {
text-align: center;
max-width: 1200px;
margin: 0 auto;
}
.latest_projects p {
margin: 0;
color: transparent;
}
.fluid-container img {
height: 350px;
width: 350px;
margin-bottom: 20px;
vertical-align: middle;
}
/*******Project Images******/
ul.projects-list {
list-style-type: none;
margin: 0;
padding: 0;
text-align: center;
}
ul.projects-list li {
display: inline-block;
height: 380px;
position: relative;
width: 380px;
}
span.text-content {
background: rgba(0,0,0,0.5);
color: white;
cursor: pointer;
display: table;
height: 380px;
left: 0;
position: absolute;
top: 0;
width: 380px;
}
span.text-content span {
display: table-cell;
text-align: center;
vertical-align: middle;
}
span.text-content {
background: rgba(0,0,0,0.5);
color: white;
cursor: pointer;
display: table;
height: 380px;
left: 0;
position: absolute;
top: 0;
width: 380px;
opacity: 0;
}
ul.projects-list li:hover span.text-content {
opacity: 1;
}
span.text-content {
background: rgba(0,0,0,0.5);
color: white;
cursor: pointer;
display: table;
height: 380px;
left: 0;
position: absolute;
top: 0;
width: 380px;
opacity: 0;
-webkit-transition: opacity 500ms;
-moz-transition: opacity 500ms;
-o-transition: opacity 500ms;
transition: opacity 500ms;
}
span.project-type {
position: absolute;
text-align: center;
/*margin: 25px 0;*/
padding: 120px;
width: 380px;
vertical-align: middle;
font-size: 1.7em;
}
span.project-name {
font-size: 2.5em;
}
span.view-project {
position: absolute;
text-align: center;
/*margin: 25px 0;*/
padding: 10px;
width: 380px;
vertical-align: middle;
font-size: 1.7em;
}
You can do that with Javascript. Basically you have a container, inside which you need to see/use extra content if you hover on it. I suggest that you should add the needed html, but with display: none; CSS rule, and then you need to show it when the user hovers the container and hide it if the use leaves the container. This is how you can do it with jQuery:
$(".yourcontainerclass").mouseenter(function() {
$(this).find(".yourinnerclass").hide();
});
$(".yourcontainerclass").mouseout(function() {
$(this).find(".yourinnerclass").show();
});