Im coding a blog and trying to make "Read More" button at the bottom of article. When i use hover to make button green, it works only if user points his mouse at left or right of button. When im pointing mouse at center of text nothing is working.
<div class="readmore"><p>Read more</p></div>
.readmore
{
color: darkgreen;
border: 1px solid green;
margin-left: 177px;
margin-right: 177px;
font-size: 13px;
margin-top: 30px;
}
.readmore:hover
{
background-color: darkgreen;
transition: 0.18s linear;
color: white;
}
I expect button to backgroundcolor darkgreen and color white when im pointing mouse at center of text.
ALL CSS CODE:
body
{
background-color: white;
width: 100%;
margin: auto;
font-family: 'Open Sans', sans-serif;
background-color: palegreen;
}
.mateleafs
{
color: forestgreen;
font-size: 21px;
font-family: 'Merienda', cursive;
}
.header
{
background-color: white;
text-align: center;
padding-top: 1px;
padding-bottom: 3px;
border-bottom: green 2px solid;
font-weight: bold;
font-family: 'Roboto', sans-serif;
}
ul
{
word-spacing: 100px;
}
li
{
list-style-type: none;
display: inline-block;
font-size: 15px;
}
a
{
text-decoration: none;
color: black;
padding-top: 35px;
padding-bottom: 22px;
padding-left: 25px;
padding-right: 25px;
}
.home a
{
color: green;
}
.mateleafs a
{
color: green;
}
.home a:hover
{
background-color: yellow;
}
.history a:hover
{
background-color: dodgerblue;
}
.health a:hover
{
background-color: limegreen;
}
.energy a:hover
{
background-color: red;
}
.other a:hover
{
background-color: gray;
}
.mateleafs:hover
{
transform: rotate(-1deg);
}
.grid-content-container
{
display: grid;
margin-left: 50px;
margin-top: 230px;
margin-right: 50px;
grid-template-columns: 450px 450px 450px;
grid-column-gap: 30px;
grid-row-gap: 30px;
grid-auto-rows: 690px;
text-align: center;
}
.grid-content-container a
{
color: black;
}
article
{
background-color: navajowhite;
font-size: 15px;
color: darkgreen;
text-align: center;
}
main
{
background-color: white;
}
.footer
{
border-top: 2px solid green;
background-color: white;
padding: 10px;
margin-top: 60px;
text-align: center;
}
img:hover
{
opacity: 0.7;
transition: 0.45s ease-out;
}
.grid-content-container h2:hover
{
color: green;
transition: 0.45s ease-out;
}
.readmore
{
color: darkgreen;
border: 1px solid green;
margin-left: 177px;
margin-right: 177px;
font-size: 13px;
margin-top: 25px;
}
.readmore:hover
{
background-color: darkgreen;
transition: 0.24s ease-out;
color: white;
}
.date
{
font-size: 12px;
color: seagreen;
}
i
{
margin-right: 2px;
}
Your CSS and HTML work fine (as tested below). I assume you have some p tag styling that is overwriting the readmore style.
.readmore
{
color: darkgreen;
border: 1px solid green;
margin-left: 177px;
margin-right: 177px;
font-size: 13px;
margin-top: 30px;
}
.readmore:hover
{
background-color: darkgreen;
transition: 0.18s linear;
color: white;
}
<div class="readmore"><p>Read more</p></div>
.readmore
{
display: block;
width: 200px;
padding: 12px;
text-align: center;
}
.readmore:hover
{
background-color: gray;
transition: 0.7s;
color: black;
border-radius: 9px;
}
<div class="readmore"><p>Read more</p></div>
* Skeleton V2.0.4
* Copyright 2014, Dave Gamache
* www.getskeleton.com
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* 12/29/2014
*/
/* Grid
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.container {
position: relative;
width: 100%;
max-width: 960px;
margin: 0 auto;
padding: 0 20px;
box-sizing: border-box; }
.column,
.columns {
width: 100%;
float: left;
box-sizing: border-box; }
/* For devices larger than 400px */
#media (min-width: 400px) {
.container {
width: 85%;
padding: 0; }
}
/* For devices larger than 550px */
#media (min-width: 550px) {
.container {
width: 90%; }
.column,
.columns {
margin-left: 4%; }
.column:first-child,
.columns:first-child {
margin-left: 0; }
.one.column,
.one.columns { width: 4.66666666667%; }
.two.columns { width: 13.3333333333%; }
.three.columns { width: 22%; }
.four.columns { width: 30.6666666667%; }
.five.columns { width: 39.3333333333%; }
.six.columns { width: 48%; }
.seven.columns { width: 56.6666666667%; }
.eight.columns { width: 65.3333333333%; }
.nine.columns { width: 74.0%; }
.ten.columns { width: 82.6666666667%; }
.eleven.columns { width: 91.3333333333%; }
.twelve.columns { width: 100%; margin-left: 0; }
.one-third.column { width: 30.6666666667%; }
.two-thirds.column { width: 65.3333333333%; }
.one-half.column { width: 48%; }
/* Offsets */
.offset-by-one.column,
.offset-by-one.columns { margin-left: 8.66666666667%; }
.offset-by-two.column,
.offset-by-two.columns { margin-left: 17.3333333333%; }
.offset-by-three.column,
.offset-by-three.columns { margin-left: 26%; }
.offset-by-four.column,
.offset-by-four.columns { margin-left: 34.6666666667%; }
.offset-by-five.column,
.offset-by-five.columns { margin-left: 43.3333333333%; }
.offset-by-six.column,
.offset-by-six.columns { margin-left: 52%; }
.offset-by-seven.column,
.offset-by-seven.columns { margin-left: 60.6666666667%; }
.offset-by-eight.column,
.offset-by-eight.columns { margin-left: 69.3333333333%; }
.offset-by-nine.column,
.offset-by-nine.columns { margin-left: 78.0%; }
.offset-by-ten.column,
.offset-by-ten.columns { margin-left: 86.6666666667%; }
.offset-by-eleven.column,
.offset-by-eleven.columns { margin-left: 95.3333333333%; }
.offset-by-one-third.column,
.offset-by-one-third.columns { margin-left: 34.6666666667%; }
.offset-by-two-thirds.column,
.offset-by-two-thirds.columns { margin-left: 69.3333333333%; }
.offset-by-one-half.column,
.offset-by-one-half.columns { margin-left: 52%; }
}
/* Base Styles */
/* NOTE
html is set to 62.5% so that all the REM measurements throughout Skeleton
are based on 10px sizing. So basically 1.5rem = 15px :) */
html {
font-size: 62.5%; }
body {
font-size: 1.5rem;
line-height: 1.6;
font-weight: 400;
font-family: 'Roboto', sans-serif;
color: rgba(0,0,0,.7);
}
.header{
text-align: left;
}
.header img{
margin-top: 5%;
}
.header img a{
text-decoration: none;
}
.header p{
font-size: 9rem;
font-weight: 700;
line-height: 8.5rem;
font-family: 'roboto', monospace;
}
.home-feature-container{
padding: 2% 4% 6% 0;
}
.home-feature-container-onecolumn{
padding: 4% 0% 4% 0;
}
.home-feature-container img{
max-width: 100%;
}
.home-feature-container-onecolumn img{
max-width: 100%;
}
.header a{
color: #fed230;
font-weight: 700;
text-decoration: none;
}
.story-title{
text-transform:uppercase;
font-size: 4rem;
font-weight:400;
line-height: 1.2;
letter-spacing: 0rem;
}
.story-footer{
text-align: center;
border-top: 1px solid #e6e6e6;
margin-top: 10%;
}
.story-footer p{
font-size: 1.4rem;
color:#969696;
padding: 5% 0 0 0;
text-transform: uppercase;
}
#menu{
padding: 2% 0 2% 0;
}
#article{
margin: 8% 0 8% 0;
}
#home-entries{
margin: 6% 0 6% 0;
}
.navbar-list{
list-style: none;
margin-bottom: 0;
}
.navbar-item{
position: relative;
float: left;
margin-bottom:5%;
height: 40px;
}
.social{
text-decoration: underline;
}
.desc{
font-style: italic;
font-size: 1.1rem;
color:#B4B4B4;
}
.desc-story{
font-size: 1.2rem;
color: #B4B4B4;
padding: 0 0 5% 0;
font-family: 'roboto mono', monospace;
}
.desc-story a{
color:#B4B4B4;
text-decoration: underline;
}
.desc a{
color:#B4B4B4;
text-decoration: underline;
}
.writings-subtext{
font-size: 1.5rem;
margin-top: 0.4rem;
color:#969696;
margin-bottom: 2%;
font-family: 'roboto mono', monospace;
}
/* POTOGRAPHY related */
.cover-image{
margin: 0 auto;
padding: none;
}
.cover-image img{
width: 100%;
top:0; left:0;
}
.photo-set-title {
text-decoration: none;
color: #5A5A5A;
font-size: 1.7rem;
font-weight: 400;
font-family: 'roboto mono', monospace;
}
#photography-cover{
margin: 1% 2% 0% 0%;
text-align: center;
}
#photography-cover img{
max-width: 100%;
}
.photo-date{
font-size: 1.1rem;
color: #969696;
}
.photo-container {
margin-bottom: 2%;
margin-top: 8%;
}
.photo-container img{
max-width: 100%;
}
.photo-container:hover img{
}
.photo-story-container p{
text-align: center;
padding: 3% 0 3% 0;
}
.photo-breadcrumbs{
display: inline;
margin-bottom: 10%
}
.photo-breadcrumbs-one a{
color: #969696;
font-size: 1.3rem;
font-weight: 300;
text-decoration: none;
font-family: 'roboto mono', monospace;
}
.photo-breadcrumbs-two{
font-size: 2.5rem;
font-weight: 300;
text-decoration: none;
font-family: 'roboto mono', monospace;
}
/* VIDEO related */
video{
width:100%;
}
.video-container{
width: 100%;
margin: auto;
padding: 0 0 10% 0;
}
.video-container-400{
max-width: 400px;
margin: auto;
}
.video-container-360{
max-width: 360px;
margin: auto;
}
.video-container-682{
max-width: 682px;
margin: auto;
}
.video-container-644{
max-width: 682px;
margin: auto;
}
/* PORTOFLIO related */
.dates {
color: #969696;
font-size: 1.3rem;
font-weight: 300;
text-decoration: none;
font-family: 'roboto mono', monospace;
}
.photo-caption {
font-family: 'DINProMed', 'Roboto', sans-serif;
color: #969696;
font-size: 1.4rem;
font-weight: 300;
text-decoration: none;
}
.portfolio-project-container{
text-align: left;
padding: 4% 0 4% 0;
}
.portfolio-project-container p{
text-align: left;
padding: 3% 0 3% 0;
}
.portfolio-container{
margin-bottom: 20%;
}
.portfolio-big-container{
margin-bottom: 10%;
}
.portfolio-big-container img{
max-width: 100%;
display: block;
margin-bottom: 20px;
}
.portfolio-container img{
max-width: 100%;
display: block;
margin-bottom: 20px;
}
.portfolio-set-title {
text-decoration: none;
color: #5A5A5A;
font-size: 1.7rem;
font-weight:300;
font-family: 'roboto mono', monospace;
}
/* Typography */
h1, h2, h3, h4, h5, h6 {
margin-top: 0;
}
h1 { font-weight:300; line-height: 1.2; color: #000; font-family: 'Roboto Mono', monospace; padding-bottom: 30px; margin-top:4%; text-transform: uppercase;}
h2 { line-height: 1.25; margin-bottom: 2rem; margin-top: 2rem; font-weight: 300; color:#333335; letter-spacing: 0.04rem; font-family: 'Roboto Mono', monospace; }
h3 { font-size: 2.5rem; line-height: 1.25; margin-bottom: 0rem; margin-top: 2%; font-weight: 400;font-family: 'Roboto Mono', monospace; }
h4 { font-weight:400; line-height: 1.2; letter-spacing: 0rem; }
h5 { font-size: 1.4rem; line-height: 1.5; padding: 2% 0 0% 0; color: #969696; margin-bottom: .2rem; font-weight:500; letter-spacing: 0.1rem;}
h6 { font-family: 'Open Sans', serif; text-transform:uppercase; font-size: 1.5rem; font-weight:600; line-height: 1.2; letter-spacing: 0rem;}
/* phone */
#media (max-width: 550px) {
.header p{
font-size: 6rem;
font-weight: 700;
line-height: 6rem;
font-family: 'roboto', monospace;
}
}
p {
margin-top: 0;
padding-right:0%;
line-height: 3rem}
p a{
/* text-decoration: underline; */
color: #2963ff;
}
/* Links */
a {
text-decoration: none;
color: #969696;
cursor: pointer;
}
/* Forms */
input[type="email"],
input[type="number"],
input[type="search"],
input[type="text"],
input[type="tel"],
input[type="url"],
input[type="password"],
textarea,
select {
height: 38px;
padding: 6px 10px; /* The 6px vertically centers text on FF, ignored by Webkit */
background-color: #fff;
border: 1px solid #D1D1D1;
border-radius: 4px;
box-shadow: none;
box-sizing: border-box; }
/* Removes awkward default styles on some inputs for iOS */
input[type="email"],
input[type="number"],
input[type="search"],
input[type="text"],
input[type="tel"],
input[type="url"],
input[type="password"],
textarea {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none; }
textarea {
min-height: 65px;
padding-top: 6px;
padding-bottom: 6px; }
input[type="email"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="text"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
border: 1px solid #33C3F0;
outline: 0; }
label,
legend {
display: block;
margin-bottom: .5rem;
font-weight: 600; }
fieldset {
padding: 0;
border-width: 0; }
input[type="checkbox"],
input[type="radio"] {
display: inline; }
label > .label-body {
display: inline-block;
margin-left: .5rem;
font-weight: normal; }
/* Lists */
ul {
list-style: circle inside; }
ol {
list-style: decimal inside; }
ol, ul {
padding-left: 0;
margin-top: 0; }
ul ul,
ul ol,
ol ol,
ol ul {
margin: 1.5rem 0 1.5rem 3rem;
font-size: 90%; }
li {
padding-left: 1rem;
margin-bottom: 1rem; }
/* Code */
code {
padding: .2rem .5rem;
margin: 0 .2rem;
font-size: 90%;
white-space: nowrap;
background: #F1F1F1;
border: 1px solid #E1E1E1;
border-radius: 4px; }
pre > code {
display: block;
padding: 1rem 1.5rem;
white-space: pre; }
/* Tables */
th,
td {
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid #E1E1E1; }
th:first-child,
td:first-child {
padding-left: 0; }
th:last-child,
td:last-child {
padding-right: 0; }
/* Spacing */
button,
.button {
margin-bottom: 1rem; }
input,
textarea,
select,
fieldset {
margin-bottom: 1.5rem; }
pre,
blockquote,
dl,
figure,
table,
p,
ul,
ol,
form {
margin-bottom: 2.5rem; }
/* Utilities */
.u-full-width {
width: 100%;
box-sizing: border-box; }
.u-max-full-width {
max-width: 100%;
box-sizing: border-box; }
.u-pull-right {
float: right; }
.u-pull-left {
float: left; }
/* Misc */
hr {
margin-top: 3rem;
margin-bottom: 3.5rem;
border-width: 0;
border-top: 1px solid #E1E1E1; }
/* Clearing */
/* Self Clearing Goodness */
.container:after,
.row:after,
.u-cf {
content: "";
display: table;
clear: both; }
/* Media Queries */
/*
Note: The best way to structure the use of media queries is to create the queries
near the relevant code. For example, if you wanted to change the styles for buttons
on small devices, paste the mobile query code up in the buttons section and style it
there.
*/
/* Larger than mobile */
#media (min-width: 400px) {}
/* Larger than phablet (also point when grid becomes active) */
#media (min-width: 550px) {}
/* Larger than tablet */
#media (min-width: 750px) {}
/* Larger than desktop */
#media (min-width: 1000px) {}
/* Larger than Desktop HD */
#media (min-width: 1200px) {}
/* MORE CSS */
.value-prop {
margin-top: 1rem; }
.value-props {
margin-top: 4rem;
margin-bottom: 4rem; }
.docs-section {
padding: 4rem 0;
margin-bottom: 0;}
.value-img {
display: block;
text-align: center;
margin: 2.5rem auto 0; }
.example-grid .column,
.example-grid .columns {
background: #EEE;
text-align: center;
border-radius: 4px;
font-size: 1rem;
text-transform: uppercase;
height: 30px;
line-height: 30px;
margin-bottom: .75rem;
font-weight: 600;
letter-spacing: .1rem; }
.example {
position: relative;
margin-top: 4rem; }
.example-screenshot-wrapper {
border-radius: 0px;
display: block;
position: relative;
overflow: hidden;
height: 250px;
}
.example-screenshot-wrapper:hover {
box-shadow: 0, 0;
}
.example-screenshot {
width: 100%;
height: auto; }
.navbar {
display: none; }
/* Larger than phone */
#media (min-width: 550px) {
.value-props {
margin-top: 9rem;
margin-bottom: 7rem; }
.value-img {
margin-bottom: 1rem; }
.example-grid .column,
.example-grid .columns {
margin-bottom: 1.5rem; }
.docs-section {
padding: 0rem 0; }
.example-send-yourself-copy {
float: right;
margin-top: 12px; }
.example-screenshot-wrapper {
position: absolute;
width: 48%;
height: 100%;
left: 0;
max-height: none; }
}
/* ----------- BUTTONS ----------- */
/* NAVIGATION BAR */
.navbar-link {
font-family: 'DINProBold', 'Roboto', sans-serif;
color: #969696;
margin-right: 35px;
font-size: 1.3rem;
text-transform: uppercase;
letter-spacing: 0.2rem;
border: none;
white-space: nowrap;
background-color: #FFF;
padding-bottom: 5px;
border-radius: 0px;
padding-left: 0;
padding-right: 0;
cursor: pointer;
border-bottom: 5px solid #FFF;
transition: color .20s ease-in;
-moz-transition: color .20s ease-in;
-webkit-transition: color .20s ease-in;
transition: border-bottom .20s ease-in;
-moz-transition: border-bottom .20s ease-in;
-webkit-transition: border-bottom .20s ease-in;
}
.navbar-link:hover {
color:#333333;
border-bottom: 5px solid #333333;
}
#active {
color: #333333;
border-bottom: 5px solid #333333;
}
/* SEE MORE */
.button {
font-family: 'DINProBold', 'Roboto', sans-serif;
color: #969696;
margin-right: 35px;
font-size: 1.3rem;
text-transform: uppercase;
letter-spacing: 0.2rem;
white-space: nowrap;
background-color: #FFF;
padding-bottom: 5px;
border-radius: 0px;
padding-left: 0;
padding-right: 0;
cursor: pointer;
border-bottom: 5px solid #FFF;
transition: color .20s ease-in;
-moz-transition: color .20s ease-in;
-webkit-transition: color .20s ease-in;
transition: border-bottom .20s ease-in;
-moz-transition: border-bottom .20s ease-in;
-webkit-transition: border-bottom .20s ease-in;
}
.button:hover {
color:#333333;
border-bottom: 5px solid #333333;
}
#homebtn {
margin-right: 0px;
}
#main-button {
color: #fed230;
}
#main-button:hover {
border-bottom: 5px solid #fed230;
}
#fires-button {
color: #6AABC8;
}
#massive-button {
color: #0099F7;
}
#massive-button:hover {
border-bottom: 5px solid #0099F7;
}
#processing-button {
color: #D22A88;
}
#processing-button:hover {
border-bottom: 5px solid #D22A88;
}
#volume-UI-button {
color: #FFB2AD;
}
#volume-UI-button:hover {
border-bottom: 5px solid #FFB2AD;
}
#accessibility-button {
color: #02b875;
}
#accessibility-button:hover {
border-bottom: 5px solid #02b875;
}
.contact-link {
color: #969696;
cursor: pointer;
}
.contact-link:hover {
color: #333333;
cursor: pointer;
}
.contact-link-dribble {
color: #969696;
cursor: pointer;
}
.contact-link-dribble:hover {
color: #ea4c89;
cursor: pointer;
}
.contact-link-linkedin {
color: #969696;
cursor: pointer;
}
.contact-link-linkedin:hover {
color: #0077B5;
cursor: pointer;
}
#clothed-button {
color: #DD5837;
}
#clothed-button:hover {
border-bottom: 5px solid #DD5837;
}
#sign-button {
color: #0084FF;
}
#sign-button:hover {
border-bottom: 5px solid #0084FF;
}
#cablecar-button {
color: #EF6967;
}
#cablecar-button:hover {
border-bottom: 5px solid #EF6967;
}
/* ----------- LINKS ----------- */
#link {
color: #2963ff;
font-family: 'DINProBold', 'Roboto', sans-serif;
border-bottom: 3px solid #FFF;
transition: border-bottom .20s ease-in;
-moz-transition: border-bottom .20s ease-in;
-webkit-transition: border-bottom .20s ease-in;
}
#link:hover {
border-bottom: 3px solid #2963ff;
}
.centered {
display: block;
margin-left: auto;
margin-right: auto;
}
.center {
text-align: center !important;
}
#option-back:hover {
color: #333333;
cursor: pointer;
}
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Basic Page Needs
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta charset="utf-8">
<title> 🙋 Megan Mitchell's Portfolio</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#000000">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-121696572-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-121696572-1');
</script>
<!-- End Google Analytics -->
<!-- Mobile Specific Metas
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- FONT
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link href="https://fonts.googleapis.com/css?family=Roboto:400,500,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500" rel="stylesheet">
<!-- CSS
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/skeleton.css">
<!-- Javascript
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<script type="text/javascript" src="javascript/code.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Favicon
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="icon" type="image/png" href="http://perceptioncube.com/M_Port/images/favicon.png">
</head>
<body>
<!-- On load fade in page -->
<script>
$(document).ready(function() {
$("body").css("display", "none");
$("body").fadeIn(150);
$("a.transition").click(function(event){
event.preventDefault();
linkLocation = this.href;
$("body").fadeOut(100, redirectPage);
});
function redirectPage() {
window.location = linkLocation;
}
});
</script>
<!-- Primary Page Layout
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="container">
<!-- logo -->
<div class="onecolumn" style="margin-top: 4%; margin-bottom:2%;">
<a href="index.html"> <img border="0" alt="Megan Mitchell Portfolio" src="images/megan_mitchell_dark.png" width="200" height="57">
</div>
<!-- end logo-->
<section class="header">
<div class="row" id="menu">
<div class="onecolumn" style="margin-top: 2%; margin-bottom:10%;">
<ul class="navbar-list"">
<li class="navbar-item"><a class="transition, navbar-link" id="active" href="index.html">Work</a></li>
<li class="navbar-item"><a class="transition, navbar-link" href="contact.html">Contact</a></li>
<li class="navbar-item"><a class="transition, navbar-link" href="illustrations.html">Illustrations</a></li>
<li class="navbar-item"><a class="transition, navbar-link" href=" https://thenounproject.com/megan.mitchell/" target="blank">Icons</a></li>
</ul>
</div>
</div>
<div class="row">
<div class="onecolumn">
<p id="DINBold">Interactive Art Director & designer, currently at Apple. </p>
</div>
</div>
</section>
<div class="docs-section examples" id="home-entries">
<a name="apple"></a>
<!-- Apple 1 -->
<div class="home-feature-container">
<div class="row example">
<a class="example-screenshot-wrapper" id="google-img" href="apple_pass.html"> <img class="example-screenshot" src="images/landing/apple_landing.jpg"> </a>
<div class="one-half offset-by-one-half column">
<br>
<h2 class="example-header"><span id="heading">Various Projects </span><span id="heading2">for Apple</span></h2>
<p><span class="dates" id="subheading">Nov 2014 · Present</span></p>
<p class="example-description">A variety of interactive projects for Apple since 2014 ranging from marketing websites to application design.</p>
<a class="button" id="main-button" href="apple_pass.html">See more</a>
<br>
<br>
</div>
</div>
</div>
<a name="ocho"></a>
<!-- ocho -->
<div class="home-feature-container">
<div class="row example">
<a class="example-screenshot-wrapper" id="google-img" href="ocho.html"> <img class="example-screenshot" src="images/landing/ocho_landing.jpg"> </a>
<div class="one-half offset-by-one-half column">
<br>
<br>
<h2 class="example-header"><span id="heading">Product Design </span><span id="heading2">for Ocho</span></h2>
<p><span class="dates" id="subheading">Produced for Ocho</span></p>
<p class="example-description">Lead designer halfway through the project to assist with look and feel, design needs, on-boarding, UI and UX.</p>
<a class="button" id="main-button" href="ocho.html">See more</a>
<br>
<br>
<br>
</div>
</div>
</div>
<a name="chaos"></a>
<!-- State Farm Chaos -->
<div class="home-feature-container">
<div class="row example">
<a class="example-screenshot-wrapper" id="google-img" href="statechaos.html"> <img class="example-screenshot" src="images/landing/chaos_landing.jpg"> </a>
<div class="one-half offset-by-one-half column">
<br>
<h2 class="example-header"><span id="heading">App Design </span><span id="heading2">for Statefarm</span></h2>
<p><span class="dates" id="subheading">Produced at DDB</span></p>
<p class="example-description">Application concept and design for State of Chaos application that launches from an iAd.</p>
<a class="button" id="main-button" href="chaos.html">See more</a>
<br>
<br>
</div>
</div>
</div>
</div>
<!-- End Document
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
</body>
</html>
I'm not sure how I did this, but after cleaning my cache I realized that my site that I'm working on has lost the containers somehow. Reverting to older code hasn't helped fix the issue so I'm not sure where to start fixing this.
The site looks ok in safari, but is broken in Firefox or chrome. Any support for a coding novice would be really appreciated.
http://perceptioncube.com/M_Port/index.html
Currently all of the content is going edge to edge on the browser window, and but is could be centered within a 980px container. This has resulted in all content to be uncentered in a containing on all pages. Additionally I'm images throughout the site had a max width to them, but now they continue to grow as I increase the size of the browser.
EDIT: Actual answer: You are missing a /* as the first line of your CSS to start the block comment. The broken block comment is breaking the rules below it.
Looks to me like the CSS in your media queries are overriding the default styles, so on any device larger than 400px it will not apply the max-width: 960px; rule you are looking for. This is the problem code:
/* For devices larger than 400px */
#media (min-width: 400px) {
.container {
width: 85%;
padding: 0;
}
}
/* For devices larger than 550px */
#media (min-width: 550px) {
.container {
width: 90%;
}
}
You can see this by inspecting the element in Chrome dev tools:
How change text when I push cursor in button? If I push cursor in button with price, will show text: "Add to basket".
This is Code:
body {
font-family: 'Roboto', sans-serif;
}
.price {
font-size: 1em;
border-radius: 50px;
background-color: #f00;
text-align: center;
color: #fff;
padding: 5px;
width: 10%;
margin: 20px auto;
}
.price:hover {
background-color: #fff;
border: 1px solid #bfbfbf;
color: #f00;
cursor: pointer;
}
.info {
display: none;
}
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"/>
<div class="price">$50</div>
<div class="info">Add to basket</div>
How solve this problem?
You can use a wrapper div to catch the over, I think is more maintainable if you change the html in the future:
body {
font-family: 'Roboto', sans-serif;
}
.price {
font-size: 1em;
border-radius: 50px;
background-color: #f00;
text-align: center;
color: #fff;
padding: 5px;
width: 10%;
margin: 20px auto;
}
.price:hover {
background-color: #fff;
border: 1px solid #bfbfbf;
color: #f00;
cursor: pointer;
}
.info {
display: none;
width: 20%;
margin: 20px auto;
cursor: pointer;
}
.wrapper:hover .info {
display: block;
}
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"/>
<div class="wrapper">
<div class="price">$50</div>
<div class="info">Add to basket</div>
</div>
you can use :active to show text when mouse is clicking down on the price like so:
.price {
font-size: 1em;
border-radius: 50px;
background-color: #f00;
text-align: center;
color: #fff;
padding: 5px;
width: 10%;
margin: 20px auto;
}
.price:hover {
background-color: #fff;
border: 1px solid #bfbfbf;
color: #f00;
cursor: pointer;
}
.info {
display: none;
}
.price:active + .info {
display: block;
}
<div class="price">$50</div>
<div class="info">Add to basket</div>
if you are trying to show the text on :hover like the title of the question says the unser :hover like so:
.price {
font-size: 1em;
border-radius: 50px;
background-color: #f00;
text-align: center;
color: #fff;
padding: 5px;
width: 10%;
margin: 20px auto;
}
.price:hover {
background-color: #fff;
border: 1px solid #bfbfbf;
color: #f00;
cursor: pointer;
}
.info {
display: none;
}
.price:hover + .info {
display: block;
}
<div class="price">$50</div>
<div class="info">Add to basket</div>
Update 3:
.price {
font-size: 1em;
border-radius: 50px;
background-color: #f00;
text-align: center;
color: #fff;
padding: 5px;
width: 10%;
margin: 20px auto;
}
.price:hover {
background-color: #fff;
border: 1px solid #bfbfbf;
color: #f00;
cursor: pointer;
}
.info,
.price:hover .amount {
display: none;
}
.price:hover .info {
display: block;
}
<div class="price">
<div class="amount">$50</div>
<div class="info">Add to basket</div>
</div>
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
Top margin of first card is result of float: right applied on button.
If I remove that right float, top margin appears above second card. What's proper way to fix this? Where to apply clearfix(es)?
check example on codepen
Just add float: left; to .card CSS class and remove float: right; from .btn
body {
font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
font-size: 1rem;
line-height: 1.5;
color: #373a3c;
background-color: #eee;
}
.card {
max-width: 20rem;
display: inline-block;
margin-bottom: 0.75rem;
background-color: #fff;
border-radius: 0.25rem;
border: 1px solid rgba(0,0,0,0.125);
float: left;
}
.card-wide {
display: inline-block;
position: relative;
width: 35rem;
margin-bottom: 0.75rem;
background-color: #fff;
border-radius: 0.25rem;
border: 1px solid rgba(0,0,0,0.125);
.card-img-left {
float: left;
width: 15rem;
height: 100%;
border-top-left-radius: 0.25rem;
border-bottom-left-radius: 0.25rem;
}
.card-block-wide {
box-sizing: border-box;
float: left;
width: 20rem;
height: 100%;
padding: 1.25rem;
.card-title-wide {
margin: 0;
font-size: 1.5rem;
}
}
.btn-wide {
position: absolute;
bottom: 0; right: 0;
box-sizing: border-box;
width: 20rem;
line-height: 1.5;
text-align: center;
cursor: pointer;
padding: 0.75rem 1rem;
font-size: 1rem;
border-bottom-right-radius: 0.25rem;
text-decoration: none;
}
}
.card-img-top {
width: 100%;
display: block;
height: 180px;
border-top-right-radius: 0.25rem;
border-top-left-radius: 0.25rem;
}
.card-block {
padding: 1.25rem;
&::after {
content: "";
display: table;
clear: both;
}
}
.card-title {
margin-top: 0;
margin-bottom: 0.75rem;
font-size: 1.5rem;
small {
&::before {
content: "(";
}
&::after {
content: ")";
}
font-size: 0.75rem;
color: #777;
}
}
.btn {
line-height: 1.25;
text-align: center;
cursor: pointer;
padding: 0.5rem 1rem;
font-size: 1rem;
border-radius: 0.25rem;
text-decoration: none;
/*float: right;*/
}
.btn-primary {
color: #fff;
background-color: #0275d8;
border-color: #0275d8;
&:hover {
color: #fff;
background-color: #025aa5;
border-color: #01549b;
}
}
.btn-primary:focus, .btn-primary.focus {
color: #fff;
background-color: #025aa5;
border-color: #01549b;
}
.btn-success {
color: #fff;
background-color: #5cb85c;
border-color: #5cb85c;
&:hover {
color: #fff;
background-color: #449d44;
border-color: #419641;
}
}
.btn-success:focus, .btn-success.focus {
color: #fff;
background-color: #449d44;
border-color: #419641;
}
<div class="container">
<div class="card">
<img src="http://image.tmdb.org/t/p/original/c5o7FN2vzI7xlU6IF1y64mgcH9E.jpg" alt="Card image cap" class="card-img-top" />
<div class="card-block">
<h4 class="card-title">The Prestige <small>2006</small></h4>
<p class="card-text">
Two stage magicians engage in competitive one-upmanship in an attempt to create the ultimate stage illusion.</p>
Add as favourite
</div>
</div>
<div class="card-wide">
<img src="http://i.imgur.com/g0Fl4pn.jpg" class="card-img-left">
<div class="card-block-wide">
<h4 class="card-title-wide">Inception</h4>
<p class="card-text-wide">
Two stage magicians engage in competitive one-upmanship in an attempt to create the ultimate stage illusion.</p>
</div>
Add as favourite
</div>
</div>
I have this problem going on:
This is the format in which the relationship heirarchy parent-child is maintained.
<div class="ContainerTitle">SYLLABUS:
<div class="DownloadThis"></div>
<div class="ViewThis"></div>
<div class="showHint"></div>
</div>
I wanted the property of inline-block for .DownloadThis and .ViewThis so I defined them as inline-block.
I have defined .ContainerTitle as block
However, the property of .ContainerTitle over there in the screenshot can be clearly observed as inline-block
What is happening? Why is my child container overriding the definition of its parent?(or is this really happening?? or something else?)
What I want to do:
Make .ContainerTitle a display:block so that the next <div>Sixth (6th) Semester</div> containers will go to the next line... instead of sticking to the previous container awkwardly!
I want the whole .ContainerTitle to behave as a block and then all the divs inside it to behave as inline-block
I want to get a result like this:
Below is my snippet. Please look at it and tell me what needs to be done :)
.ContainerTitle {
display: block;
/* WHY IS THIS^ NOT WORKING?????*/
background: #fff;
float: left;
padding: 15px;
padding-left: 15px;
border: solid 1px #000;
font-size: Large;
color: #000;
text-align: left;
cursor: pointer;
transition: all .1s ease-out;
}
.DownloadThis,
.ViewThis {
display: inline-block;
padding: 20px;
padding-bottom: 10px;
border: solid 1px #fff;
width: 40px;
}
.showHint {
margin-top: 20px;
background: #f1f1f1;
transition: all .9 ease-out;
}
.ContainerTitle:hover .showHint:after {
content: '*Hint: Hint Text';
transition: all .9 ease-out;
}
.ViewThis:hover + .showHint:after {
content: '*Hint: View Online';
transition: all .9 ease-out;
}
.DownloadThis:hover ~ .showHint:after {
content: '*Hint: Download This';
transition: all .9 ease-out;
}
.DownloadThis {
background: #1D9C73;
color: #fff;
}
.ViewThis {
background: #7D529E;
color: #fff;
}
.DownloadThis:hover,
.ViewThis:hover {
border: solid 1px #000;
background: #fff;
}
.DownloadThis:hover {
color: #1D9C73;
}
.ViewThis:hover {
color: #7D529E;
}
.ContainerTitle:before,
.DownloadThis:before,
.ViewThis:before {
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
padding-left: 6px;
padding-right: 8px;
font-size: 32px;
}
.ContainerTitle:before {
content: '\f0f6';
font-size: 24px;
}
.DownloadThis:before {
content: '\f019';
}
.ViewThis:before {
content: '\f06e';
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css" rel="stylesheet" />
<div class="ContainerTitle">TESTING:
<div class="DownloadThis"></div>
<div class="ViewThis"></div>
<div class="showHint"></div>
</div>
<div style="background: #4399CD; padding: 30px; color: #fff;display:inline-block;padding-left: 15px; ">
Sixth (6th) Semester
</div>
.ContainerTitle {
display: block;
/* WHY IS THIS^ NOT WORKING?????*/
background: #fff;
float: left;
padding: 15px;
padding-left: 15px;
border: solid 1px #000;
font-size: Large;
color: #000;
text-align: left;
cursor: pointer;
transition: all .1s ease-out;
}
.DownloadThis,
.ViewThis {
display: inline-block;
padding: 20px;
padding-bottom: 10px;
border: solid 1px #fff;
width: 40px;
}
.showHint {
margin-top: 20px;
background: #f1f1f1;
transition: all .9 ease-out;
}
.ContainerTitle:hover .showHint:after {
content: '*Hint: Hint Text';
transition: all .9 ease-out;
}
.ViewThis:hover + .showHint:after {
content: '*Hint: View Online';
transition: all .9 ease-out;
}
.DownloadThis:hover ~ .showHint:after {
content: '*Hint: Download This';
transition: all .9 ease-out;
}
.DownloadThis {
background: #1D9C73;
color: #fff;
}
.ViewThis {
background: #7D529E;
color: #fff;
}
.DownloadThis:hover,
.ViewThis:hover {
border: solid 1px #000;
background: #fff;
}
.DownloadThis:hover {
color: #1D9C73;
}
.ViewThis:hover {
color: #7D529E;
}
.ContainerTitle:before,
.DownloadThis:before,
.ViewThis:before {
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
padding-left: 6px;
padding-right: 8px;
font-size: 32px;
}
.ContainerTitle:before {
content: '\f0f6';
font-size: 24px;
}
.DownloadThis:before {
content: '\f019';
}
.ViewThis:before {
content: '\f06e';
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css" rel="stylesheet" />
<div class="ContainerTitle">TESTING:
<div class="DownloadThis"></div>
<div class="ViewThis"></div>
<div class="showHint"></div>
</div>
<div style="background: #4399CD; padding: 30px; color: #fff;display:inline-block;padding-left: 15px; clear:both; float:left">
Sixth (6th) Semester
</div>
Try the following css in your div(<div>Sixth (6th) Semester</div>):
clear:both;
float:left;