how to make sizes look the same on all screens - html

So, I am working on two sites, and the padding seems to change tremendously on different screens, I was wondering if this was potentially due to the units I am using? Or the specific CSS tag? However, I am hoping someone can figure it out for me
Two bits of code that keep changing:
codepen
.divider {
background-color: #3498db;
padding-top: 5%;
padding-bottom: 5%;
font-family: Open Sans;
font-weight: 300;
text-align: center;
}
.divider h1 {
margin-bottom: 10px;
margin-top: 0%;
padding-top: 20%;
font-weight: 500;
color: white;
}
.divider p {
color: white;
margin-bottom: 5px;
font-family: Open Sans;
text-align: center;
}
.divider button {
padding: 10px;
height: 15%;
cursor: auto;
width: 17%;
margin-top: 30px;
border-radius: 50px;
text-align: center;
color: white;
border: white 1px solid;
background-color: #3498db;
}
.divider button:hover {
background-color: white;
color: black;
transition: all 0.3s ease 0s;
}
<div class="divider">
<h1>See Something You Like?</h1>
<p>Feel free to contact us at any time and we’ll have someone reply to you 6 as soon as possible.
<br>industry's standard dummy text ever since the 1500s
<br>
<br>Whenever you’re ready, email us with the details you want on your website, and we will
<br>respond with a rough price.</p>
<a href="mailto:hello#baseframe.co">
<button>Email</button>
</a>
</div>
on this, the top padding gets super big (or sometimes it gets smaller) on different screens.
codepen
* {
margin: 0 auto;
padding: 0;
}
html {
height: 100%;
}
body {
font-family: 'Open Sans';
font-weight: 400;
height: 100%;
background-color: #ddd;
}
.nav {
background: rgba(0, 0, 0, 0);
position: absolute;
width: 100%;
}
.nav ul {
text-align: right;
vertical-align: middle;
margin-right: 15px;
margin-top: 15px;
font-size: 1.1em;
}
.nav li {
padding-top: 5px;
list-style: none;
display: inline-block;
padding: 15px;
}
.nav a {
margin-top: 17px;
bottom: 0;
display: inline-block;
color: white;
text-decoration: none;
}
.nav a:hover {
color: #3498db;
transition: ease 0.5s all 0s;
}
.nav hr {
opacity: 0.2;
width: 95%;
text-align: center;
}
.nav-logo {
vertical-align: middle;
top: 0;
float: left;
width: 5%;
display: inline-block;
}
.nav-logo img {
width: 250%;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
}
/*-------------------Home-Page-------------------*/
.home-page {
background-image: url("http://baseframe.co/getanimus/img/cover1.jpg");
background-size: cover;
background-position: top;
background-attachment: fixed;
padding-bottom: 17%;
text-align: center;
}
.home-page h1 {
color: white;
padding-top: 15%;
font-size: 5em;
text-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
}
.home-page input {
cursor: auto;
}
.home-page p {
font-weight: 300;
color: white;
margin-bottom: 15px;
}
button#infl {
background-color: #3498db;
color: white;
font-size: 1em;
width: 15%;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
font-family: montserrat;
padding: 15px;
margin: 5px;
border-top-left-radius: 2em;
border-top-right-radius: 2em;
border-bottom-left-radius: 2em;
border-bottom-right-radius: 2em;
border: none;
cursor: auto;
}
button#brands {
background-color: white;
color: #7f8c8d;
font-size: 1em;
width: 15%;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
font-family: montserrat;
padding: 15px;
margin: 5px;
border-top-left-radius: 2em;
border-top-right-radius: 2em;
border-bottom-left-radius: 2em;
border-bottom-right-radius: 2em;
border: none;
cursor: auto;
}
button#brands:hover {
opacity: 0.8;
transition: all 0.3s ease 0s;
}
button#infl:hover {
opacity: 0.8;
transition: all 0.3s ease 0s;
}
/*-------------------About-------------------*/
.about {
background-color: white;
padding-bottom: 10%;
}
.about h1 {
text-align: left;
margin-left: 20%;
margin-top: 5%;
}
.about hr {
background-color: #3498db;
height: 5px;
border: none;
margin-top: 2%;
margin-left: 20%;
width: 5%;
text-align: left;
float: left
}
.about p {
margin-left: 20%;
margin-right: 20%;
line-height: 30px;
margin-top: 5%;
text-align: left;
}
<div class="nav">
<ul>
<li class="nav-logo">
<img src="http://baseframe.co/getanimus/img/logo_white.png">
</li>
<li>Home</li>
<li>Influencers</li>
<li>Brands</li>
<li>Contact</li>
<hr>
</div>
<div class="home-page">
<h1>Animus Digital</h1>
<p>Premium Talent Management Agency</p>
<button id="infl">Influencers</button>
<button id="brands">Brands</button>
</div>
this website navigation doesn't align properly with the logo on the left, for some reason. In addition, on a 1920 x 1080 screen, the buttons get pretty wide.
Really appreciate any help on this. Thanks.

The reason why the sizes of those elements changes on different screens is because you use % instead of px. % scales the size with the browser's size.
You should use CSS Media queries

For first case since you are using % in padding, which leads to unexpected behavior in different situations.
For "n%" margin (and padding) to be the same for
margin-top/margin-right/margin-bottom/margin-left, all four have to be
relative to the same base. If top/bottom used a different base than
left/right', then "n%" margin (and padding) wouldn't mean the same
thing on all four sides.
(Also note having the top/bottom margin relative to the width enables
a weird CSS hack that allows you to specify a box with an unchanging
aspect ratio ...even if the box is rescaled.)
% with margin/padding

Related

Why is indicated distance so long? Html, css

Why is indicated distance so long? Here is an image:
Here is the full code:
body {
margin: 10px;
font-size: 28px;
font-family: 'Open Sans', sans-serif;
background-color: #ffffff;
}
.footer {
font-size: 2vw;
width: 100%;
padding: 10px 0 10px 0;
margin-top: 0px;
margin-bottom: 0px;
background-color: #ddd;
color: #333;
text-indent: 0px;
text-align: center;
}
.footer0 {
font-size: 16px;
width: calc(100%-80px);
height: 230px;
margin: 0px;
padding-left: 40px;
padding-right: 40px;
padding-bottom: 0em;
margin-bottom: 0em;
background-color: #960017;
color: #eee;
text-indent: 20px;
}
.footer0 a:link,
.footer0 a:hover,
.footer0 a:visited,
.footer0 a:active {
color: #eee;
text-decoration: none;
}
.main {
text-indent: 50px;
margin: 5%;
text-align: justify;
}
a:link,
a:hover,
a:visited,
a:active {
color: blue;
text-decoration: underline;
}
#media screen and (min-width: 1205px) {
.code0 {
margin: auto;
margin-top: 40px;
margin-bottom: 40px;
padding: 20px;
padding-bottom: 0px;
border: 1px solid #4a3728;
/* here is the place to define the border color, the box shadow is gray anyway */
width: 1200px;
box-shadow: 0 5px 7px 0 rgba(0, 0, 0, 0.0), 0 7px 20px 0 rgba(100, 100, 100, 0.3);
}
}
.r {
border-radius: 6px;
}
<body class="code0">
<div class="main">
Welcome to the site.
</div>
<br>
<div class="footer r" style="margin-top: 20px; margin-bottom: 0px;">
<p style="margin-top: 0px; margin-bottom: 0px;">Copyright <b>Institutum Latinum Romae</b> © 2022-2022</p>
</div>
My attempt: play with the margin-bottom of the internal element, padding-bottom of the external element. It didn't work out.
I use a nice trick called code0. It enables displaying on huge screens with a nice look. It creates a rectangle on huge screens where the page is inside of it.
You don't have enough content. So you need to give the body a min-height: 100vh and apply flexbox + flex-direction: column to it. Then you can push the footer to the bottom by using margin-top: auto. That will consume all remaining space and place the footer at the bottom even when the content is insufficient to fill the viewport.
body {
margin: 10px;
font-size: 28px;
font-family: 'Open Sans', sans-serif;
background-color: #ffffff;
min-height: calc(100vh - 20px);
display: flex;
flex-direction: column;
}
.footer {
font-size: 2vw;
width: 100%;
padding: 10px 0 10px 0;
margin-top: 0px;
margin-bottom: 0px;
background-color: #ddd;
color: #333;
text-indent: 0px;
text-align: center;
}
.footer0 {
font-size: 16px;
width: calc(100%-80px);
height: 230px;
margin: 0px;
padding-left: 40px;
padding-right: 40px;
padding-bottom: 0em;
margin-bottom: 0em;
background-color: #960017;
color: #eee;
text-indent: 20px;
}
.footer0 a:link,
.footer0 a:hover,
.footer0 a:visited,
.footer0 a:active {
color: #eee;
text-decoration: none;
}
.main {
text-indent: 50px;
margin: 5%;
text-align: justify;
}
a:link,
a:hover,
a:visited,
a:active {
color: blue;
text-decoration: underline;
}
#media screen and (min-width: 1205px) {
.code0 {
margin: auto;
margin-top: 40px;
margin-bottom: 40px;
padding: 20px;
padding-bottom: 0px;
border: 1px solid #4a3728;
/* here is the place to define the border color, the box shadow is gray anyway */
width: 1200px;
box-shadow: 0 5px 7px 0 rgba(0, 0, 0, 0.0), 0 7px 20px 0 rgba(100, 100, 100, 0.3);
min-height: calc(100vh - 100px);
}
}
.r {
border-radius: 6px;
}
<body class="code0">
<div class="main">
Welcome to the site.
</div>
<br>
<div class="footer r" style="margin-top: auto; margin-bottom: 0px;">
<p style="margin-top: 0px; margin-bottom: 0px;">Copyright <b>Institutum Latinum Romae</b> © 2022-2022</p>
</div>
</body>

How can I get my shadow around my entire div?

For my site I want to show some products on my site and when you hover over these products, there should be more information. Currently the design for the product card is there. I have 2 questions that I cannot get to work.
I cannot get the shadow box around the whole div when I hover around it. Have tried to add a height to my div but that messed up the layout of my other divs. What am I doing wrong?
Also the border of my div goes through my button (at least the link I have styled as a button). How can I fix this?
.home-products {
width: auto;
height: 250px;
}
.product-image-home {
height: 200px;
}
.product-grid {
position: relative;
float: left;
margin-left: 3px;
margin-right: 3px;
text-align: center;
width: 225px;
}
.product-grid h3 {
margin: 0;
text-align: center;
margin-bottom: 5px;
font-size: 20px "Open Sans", Helvetica, Arial, sans-serif;
}
.product-overlay-button {
background: #85bf31;
height: 550px;
border: none;
border-radius: 2px;
color: #fff;
font-weight: bold;
font-size: 14px;
padding: 0.6em 2em;
margin-top: 5px;
text-decoration: none;
text-align: center;
}
.product-grid:hover {}
.product-info {
display: none;
position: absolute;
width: 225px;
position: absolute;
text-align: center;
float: left;
margin-left: 3px;
margin-right: 3px;
}
.product-info p {
margin-left: 7px;
margin-right: 7px;
}
.product-grid:hover .product-info {
display: block;
}
.product-grid:hover {
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}
<div class="home-products">
<div class="product-grid">
<img class="product-image-home" src="https://cardpile.nl/wp-content/uploads/2021/04/blood-rage-460x460.jpg" alt="Homepage">
<h3>Bloodrage</h3>
<span>€38.90</span>
<div class="product-info">
<p>Some information about the product!</p>
Vergelijk prijzen
</div>
</div>
</div>
A lot of your issues come from .product-info having position: absolute;. So remove that (both of them, you have position: absolute; in there twice); then you can add some padding-bottom to .product-grid to "fit" your button inside the div.
Check out what I did here:
.home-products {
width: auto;
height: 250px;
}
.product-image-home {
height: 200px;
}
.product-grid {
position: relative;
float: left;
margin-left: 3px;
margin-right: 3px;
text-align: center;
width: 225px;
padding-bottom: 15px;
}
.product-grid h3 {
margin: 0;
text-align: center;
margin-bottom: 5px;
font-size: 20px "Open Sans", Helvetica, Arial, sans-serif;
}
.product-overlay-button {
background: #85bf31;
height: 550px;
border: none;
border-radius: 2px;
color: #fff;
font-weight: bold;
font-size: 14px;
padding: 0.6em 2em;
margin-top: 5px;
text-decoration: none;
text-align: center;
}
.product-grid:hover {}
.product-info {
display: none;
width: 225px;
text-align: center;
float: left;
margin-left: 3px;
margin-right: 3px;
}
.product-info p {
margin-left: 7px;
margin-right: 7px;
}
.product-grid:hover .product-info {
display: block;
}
.product-grid:hover {
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}
<div class="home-products">
<div class="product-grid">
<img class="product-image-home" src="https://cardpile.nl/wp-content/uploads/2021/04/blood-rage-460x460.jpg" alt="Homepage">
<h3>Bloodrage</h3>
<span>€38.90</span>
<div class="product-info">
<p>Some information about the product</p>
Vergelijk prijzen
</div>
</div>
</div>
You can use shadow settings similar to 0px 0px 10px 4px (i.e. the first and second values are zero, so the shadow will be spread equally on all sides according to the third and fourth values):
.home-products {
width: auto;
height: 250px;
}
.product-image-home {
height: 200px;
}
.product-grid {
position: relative;
float: left;
margin-left: 3px;
margin-right: 3px;
text-align: center;
width: 225px;
}
.product-grid h3 {
margin: 0;
text-align: center;
margin-bottom: 5px;
font-size: 20px "Open Sans", Helvetica, Arial, sans-serif;
}
.product-overlay-button {
background: #85bf31;
height: 550px;
border: none;
border-radius: 2px;
color: #fff;
font-weight: bold;
font-size: 14px;
padding: 0.6em 2em;
margin-top: 5px;
text-decoration: none;
text-align: center;
}
.product-grid:hover {}
.product-info {
display: none;
position: absolute;
width: 225px;
position: absolute;
text-align: center;
float: left;
margin-left: 3px;
margin-right: 3px;
}
.product-info p {
margin-left: 7px;
margin-right: 7px;
}
.product-grid:hover .product-info {
display: block;
}
.product-grid:hover {
box-shadow: 0px 0px 10px 4px rgba(0, 0, 0, 0.2);
z-index: 1;
}
<div class="home-products">
<div class="product-grid">
<img class="product-image-home" src="https://cardpile.nl/wp-content/uploads/2021/04/blood-rage-460x460.jpg" alt="Homepage">
<h3>Bloodrage</h3>
<span>€38.90</span>
<div class="product-info">
<p>Some information about the product!</p>
Vergelijk prijzen
</div>
</div>
</div>

CSS button will not align at center of div

I have this website with a showcase div, within the div I have a "Get Started" button. I am able to vertically align the button with the margin attribute. However I do not want to horizontally align the button with margin as this will lead to some trouble for me in the future, I've tried align: center; and align="center" but the button sticks to the left side of the showcase. How can I unstick this button and horizontally align it without having to use a margin attribute?
html,
body,
header {
position: absolute;
left: 0;
top: 0;
width: 100%;
margin: 0;
margin-top: 0;
margin: auto;
padding: 0;
}
h1 {
display: inline-block;
font-family: Trebuchet MS;
font-size: 75px;
letter-spacing: 3px;
margin: 10px 0px 0px 20px;
}
h2 {
display: inline-block;
flex-direction: row;
margin: 0px 0px 0px 50px;
font-family: Georgia;
}
.highlight {
color: #45d845;
}
.heading {
background-color: #d84545;
border-bottom: 5px solid black;
padding-top: 20px;
padding-bottom: 20px;
}
#comet {
font-size: 65px;
margin-left: 20px;
}
.showcase {
background: url('background1.jpeg');
border-bottom: 5px solid black;
height: 1000px;
width: 100%;
background-size: 100% 100%;
background-repeat: no-repeat;
color: #cccccc;
}
.showcase h2 {
color: #fff;
margin-top: 170px;
font-size: 60px;
font-family: Verdana;
text-align: center;
text-shadow: 1px 3px #000;
}
#start {
align: center;
margin-top: 130px;
background-color: transparent;
color: #fff;
padding: 20px 30px 20px 30px;
text-align: center;
font-family: Helvetica;
font-weight: bold;
border-radius: 10px;
-webkit-transition-duration: 0.4s;
transition-duration: 0.4s;
}
#start:hover {
cursor: pointer;
background-color: #fff;
color: #000;
}
<header>
<div class="heading">
<h1>ThumbTac <span id="comet">☄</span> </h1>
</div>
</header>
<div class="showcase">
<h2>He moonlight difficult engrossed an it sportsmen. Interested has all devonshire difficulty jay assistance joy. Unaffected at ye </h2>
<button id="start" align="center">Get Started</button>
</div>
You can wrap your button in a div with the style text-align: center; to horizontally center your button. Example:
html, body, header{
position:absolute;
left:0;
top:0;
width: 100%;
margin: 0;
margin-top: 0;
margin: auto;
padding: 0;
}
/*Heading*/
h1{
display: inline-block;
font-family: Trebuchet MS;
font-size: 75px;
letter-spacing: 3px;
margin: 10px 0px 0px 20px;
}
h2{
display: inline-block;
flex-direction: row;
margin: 0px 0px 0px 50px;
font-family: Georgia;
}
.highlight{
color: #45d845;
}
.heading{
background-color: #d84545;
border-bottom: 5px solid black;
padding-top: 20px;
padding-bottom: 20px;
}
#comet{
font-size: 65px;
margin-left: 20px;
}
/*Showcase*/
.showcase{
background: url('background1.jpeg');
border-bottom: 5px solid black;
height: 1000px;
width: 100%;
background-size: 100% 100%;
background-repeat: no-repeat;
color: #cccccc;
}
.showcase h2{
color: #fff;
margin-top: 170px;
font-size: 60px;
font-family: Verndana;
text-align: center;
text-shadow: 1px 3px #000;
}
#start{
align: center;
margin-top: 130px;
background-color: transparent;
color: #fff;
padding: 20px 30px 20px 30px;
text-align: center;
font-family: Helvetica;
font-weight: bold;
border-radius: 10px;
-webkit-transition-duration: 0.4s; /* Safari */
transition-duration: 0.4s;
}
#start:hover{
cursor: pointer;
background-color: #fff;
color: #000;
}
<header>
<div class="heading">
<h1>ThumbTac <span id="comet">☄</span> </h1>
</div>
</header>
<div class="showcase">
<h2>He moonlight difficult engrossed an it sportsmen.
Interested has all devonshire difficulty jay
assistance joy. Unaffected at ye </h2>
<div style="text-align: center;">
<button id="start">Get Started</button>
</div>
</div>
You can consider using a flexbox. Documentation in the CSS source.
/* Global Sets */
html,
body,
header {
position: absolute;
left: 0;
top: 0;
width: 100%;
margin: 0;
margin-top: 0;
margin: auto;
padding: 0;
}
/*Heading*/
h1 {
display: inline-block;
font-family: Trebuchet MS;
font-size: 75px;
letter-spacing: 3px;
margin: 10px 0px 0px 20px;
}
h2 {
display: inline-block;
flex-direction: row;
margin: 0px 0px 0px 50px;
font-family: Georgia;
}
.highlight {
color: #45d845;
}
.heading {
background-color: #d84545;
border-bottom: 5px solid black;
padding-top: 20px;
padding-bottom: 20px;
}
#comet {
font-size: 65px;
margin-left: 20px;
}
/*Showcase*/
.showcase {
background: url('background1.jpeg');
border-bottom: 5px solid black;
height: 1000px;
width: 100%;
background-size: 100% 100%;
background-repeat: no-repeat;
color: #cccccc;
display: flex; /* Added */
flex-direction: column; /* Added */
align-items: center; /* Added, horizonal alignment */
}
.showcase h2 {
color: #fff;
margin-top: 170px;
font-size: 60px;
font-family: Verndana;
text-shadow: 1px 3px #000;
text-align: center;
}
#start {
/* align: center; Not valid CSS */
margin-top: 130px;
background-color: transparent;
color: #fff;
padding: 20px 30px 20px 30px;
/* text-align: center; No longer required */
font-family: Helvetica;
font-weight: bold;
border-radius: 10px;
-webkit-transition-duration: 0.4s;
/* Safari */
transition-duration: 0.4s;
}
#start:hover {
cursor: pointer;
background-color: #fff;
color: #000;
}
<header>
<div class="heading">
<h1>ThumbTac <span id="comet">☄</span> </h1>
</div>
</header>
<div class="showcase">
<h2>He moonlight difficult engrossed an it sportsmen. Interested has all devonshire difficulty jay assistance joy. Unaffected at ye </h2>
<button id="start" align="center">Get Started</button>
</div>

Elements within navigation resize separately rather than together

One of the biggest problems I have with navigation bars is that, whenever trying to put a logo in with a title, I always find that the image resizes itself to much smaller than the text sooner rather than later.
In the case below, I have a title at one end of the navigation/title bar and an image at the other end. When resizing or even on mobile devices, the image becomes very very small.
The html...
<div id="nav">
<p>Crowes</p>
<img src="pic.jpg" />
</div>
..and the CSS
#nav {
background-color: #7E0E0A;
box-shadow: 1px 1px 1px 1px black;
padding: 1%;
font-size: 5vh;
color: white;
font-weight: bold;
font-family: 'Pacifico';
overflow: auto;
width: 100%;
z-index: 1;
}
#nav p {
margin-left: 2%;
margin-top: 1%;
margin-bottom: 1%;
float: left;
color: white;
}
#nav img {
display: inline-block;
width: 6%;
vertical-align: middle;
float: right;
border-radius: 50%;
border: 2px solid white;
margin-right: 3%;
opacity: 0.7;
transition: all 0.2s ease;
}
It's not only just changing the size of the elements, it was also their positioning. It all had to be changed to ems rather than %.
(Nav-specific)
#nav {
background-color: #7E0E0A;
box-shadow: 1px 1px 1px 1px black;
font-size: 2.3em;
color: white;
font-weight: bold;
font-family: 'Pacifico';
overflow: auto;
width: 100%;
z-index: 1;
}
font-size to 2.3em.
(P-specific)
#nav p {
margin: 1.3em;
display: inline-block;
vertical-align: middle;
float: left;
color: white;
}
margin to 1.3em
(Img-specific)
#nav img {
display: inline-block;
height: 2.3em;
vertical-align: middle;
float: right;
border-radius: 50%;
border: 2px solid white;
margin: 1em;
opacity: 0.7;
transition: all 0.2s ease;
}
height to 2.3em, as guided by #MrLister and margin to 1em.

HTML5 CSS3 <a> element not centering inside of <div> element

#buttoncontainer {
position: absolute;
top: 15%;
left: 23%;
width: 200px;
height: 500px;
}
.buttons {
position: absolute;
display: block;
width: 70px;
height: 70px;
font-family: DancingScript-Regular;
font-size: 100%;
padding-top: 50px;
background-color: rgba(255,255,255,.0);
padding: 15px 15px;
border: 5px solid white;
border-radius: 70px;
box-shadow: 0px 0px 5px 5px #000000, 0 0 5px 5px #888 inset;
left: 15%;
-webkit-transition: all .3s ease-in-out;
-moz-transition: all .3s ease-in-out;
}
.buttonText {
text-align: center;
display: block;
padding: 25px;
width: 70px;
height: 70px;
font-size: 100%;
text-decoration: none;
color: white;
}
#b11 {
top: 30px;
}
#b22 {
top: 170px;
}
#b33 {
top: 305px;
}
<div id="buttoncontainer">
<div class="buttons" id="b11">
Upload
</div>
<div class="buttons" id="b22">
Refresh
</div>
<div class="buttons" id="b33">
Logout
</div>
</div>
I am trying to make the element fill up its parent container. But for some reason it doesn't align itself- as a whole block element inside/center of it's container, but instead pushes itself downwards and to the right. Can't figure out what I am doing wrong.
EDIT: I forgot to mention that I need the padding to center the text vertically in the bubble. I also tried padding-top: 25px; an still no success on centering the a block element.
EDIT2: I added text-align: center which centers the text correctly in the a element, but again the a element is not centering inside the div.
Here is a Working Demo
Do this in your CSS -
.buttons { text-align: center;
position: absolute;
display: block;
width: 70px;
height: 70px;
font-family: DancingScript-Regular;
font-size: 100%;
padding-top: 50px;
background-color: rgba(255,255,255,.0);
padding: 15px 15px;
border: 5px solid white;
border-radius: 70px;
box-shadow: 0px 0px 5px 5px #000000, 0 0 5px 5px #888 inset;
left: 15%;
-webkit-transition: all .3s ease-in-out;
-moz-transition: all .3s ease-in-out;
}
.buttonText { /*
width: 70px;
height: 70px;*/
display: inline-block;
padding: 18px 0 0 0;
font-size: 100%;
text-decoration: none;
color: black;
}
This centers your text vertically and horizontally in the center of the button.
.buttonText {
text-align: center;
line-height: 70px;
vertical-align:middle;
display: block;
margin: auto auto;
font-size: 100%;
text-decoration: none;
color: white;
}
Hope this helps!
(EDIT: Adjust your line height to the height of the button. vertical-align:middle; will center it vertically)
Remove padding from class .buttonText
Add line-height: 70px;, text-align: center; to center the links.
.buttonText {
display: block;
line-height: 70px;
text-align: center;
padding: 0; /*Change padding to 0*/
width: 70px;
height: 70px;
font-size: 100%;
text-decoration: none;
color: white;
}
Here's a Fiddle
Remove this in your CSS:
.buttonText {padding: 25px;}
Make it as:
.buttonText {padding: 0;}
Thank you all for the suggestions....I finally got it to work with:
.buttonText {
margin-left: -23px;
margin-top: -23px;
position: absolute;
text-align: center;
padding: 28px;
padding-top: 50px;
padding-bottom: 50px;
font-size: 100%;
text-decoration: none;
color: white;
}
Not sure why this one gave me such a hard time...I usually don't have issues when doing buttons like these.