I'm trying to get my buttons to have the same width but for some reason, it's not working. What needs to be done in order to make sure that all buttons comply with these desired results?:
All buttons must have the same width
All buttons must NOT use the whole width of the page
have the same width
/*File download button*/
.buttonFileDownload_container {
text-align: center;
margin-bottom: 20px;
}
.buttonFileDownload {
display: inline-block;
position: relative;
padding: 10px 60px;
background-color: transparent;
border: 3px solid black;
color: black;
text-decoration: none!important;
font-size: 1.5em;
line-height: 1.2;
text-align: center;
text-indent: 15px;
}
.buttonFileDownload:before,
.buttonFileDownload:after {
content: ' ';
display: block;
position: absolute;
left: 10px;
top: 52%;
}
/* Download box shape */
.buttonFileDownload:before {
width: 20px;
height: 4px;
border-style: solid;
border-width: 0 4px 4px;
}
/* Download arrow shape */
.buttonFileDownload:after {
width: 0;
height: 0;
margin-left: 6px;
margin-top: -140px;
border-style: solid;
border-width: 8px 8px 0 8px;
border-color: transparent;
border-top-color: inherit;
animation: downloadArrow 2s linear infinite;
animation-play-state: paused;
}
.buttonFileDownload:hover:before {
border-color: black;
}
.buttonFileDownload:hover:after {
border-top-color: black;
animation-play-state: running;
}
/* keyframes for the download icon anim */
#keyframes downloadArrow {
/* 0% and 0.001% keyframes used as a hackish way of having the button frozen on a nice looking frame by default */
0% {
margin-top: -14px;
opacity: 1;
}
0.001% {
margin-top: -30px;
opacity: 0;
}
50% {
opacity: 1;
}
100% {
margin-top: 0;
opacity: 0;
}
}
<p>Hello World</p>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Numbers</u><br/>
Numbers description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Colours</u><br/>
Colours description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Onomatopoeia</u><br/>
Onomatopoeia description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Alphabet</u><br/>
Alphabet description</a>
</div>
All buttons must have the same width
All buttons must NOT use the whole width of the page
The main trick is to add a wrapper in the markup, a new CSS rule and set the buttonFileDownload to display: block.
.buttonFileDownload_wrapper { /* added rule */
display: inline-block;
}
.buttonFileDownload {
display: block; /* changed to block */
...
}
If you also want them centered, set the buttonFileDownload_wrapper's parent to text-align: center (in this case the body)
body {
text-align: center; /* added property */
}
Stack snippet
/*File download button*/
body {
text-align: center; /* added property */
}
.buttonFileDownload_wrapper { /* added rule */
display: inline-block;
}
.buttonFileDownload_container {
text-align: center;
margin-bottom: 20px;
}
.buttonFileDownload {
display: block; /* changed to block */
position: relative;
padding: 10px 60px;
background-color: transparent;
border: 3px solid black;
color: black;
text-decoration: none!important;
font-size: 1.5em;
line-height: 1.2;
text-align: center;
text-indent: 15px;
}
.buttonFileDownload:before,
.buttonFileDownload:after {
content: ' ';
display: block;
position: absolute;
left: 10px;
top: 52%;
}
/* Download box shape */
.buttonFileDownload:before {
width: 20px;
height: 4px;
border-style: solid;
border-width: 0 4px 4px;
}
/* Download arrow shape */
.buttonFileDownload:after {
width: 0;
height: 0;
margin-left: 6px;
margin-top: -140px;
border-style: solid;
border-width: 8px 8px 0 8px;
border-color: transparent;
border-top-color: inherit;
animation: downloadArrow 2s linear infinite;
animation-play-state: paused;
}
.buttonFileDownload:hover:before {
border-color: black;
}
.buttonFileDownload:hover:after {
border-top-color: black;
animation-play-state: running;
}
/* keyframes for the download icon anim */
#keyframes downloadArrow {
/* 0% and 0.001% keyframes used as a hackish way of having the button frozen on a nice looking frame by default */
0% {
margin-top: -14px;
opacity: 1;
}
0.001% {
margin-top: -30px;
opacity: 0;
}
50% {
opacity: 1;
}
100% {
margin-top: 0;
opacity: 0;
}
}
<div class="buttonFileDownload_wrapper">
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Numbers</u><br/>
Numbers description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Colours</u><br/>
Colours description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Onomatopoeia</u><br/>
Onomatopoeia description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Alphabet</u><br/>
Alphabet description</a>
</div>
</div>
"width" is based on content if you don't set the width of the element. So either make all the content the same or set a width on the element.
You need to set the width of the element, otherwise its based on it's content length.
For instance:
/*File download button*/
.buttonFileDownload_container {
text-align: center;
margin-bottom: 20px;
}
.buttonFileDownload {
display: inline-block;
position: relative;
padding: 10px 60px;
background-color: transparent;
border: 3px solid black;
color: black;
text-decoration: none!important;
font-size: 1.5em;
line-height: 1.2;
text-align: center;
text-indent: 15px;
min-width:250px;
}
.buttonFileDownload:before,
.buttonFileDownload:after {
content: ' ';
display: block;
position: absolute;
left: 10px;
top: 52%;
}
/* Download box shape */
.buttonFileDownload:before {
width: 20px;
height: 4px;
border-style: solid;
border-width: 0 4px 4px;
}
/* Download arrow shape */
.buttonFileDownload:after {
width: 0;
height: 0;
margin-left: 6px;
margin-top: -140px;
border-style: solid;
border-width: 8px 8px 0 8px;
border-color: transparent;
border-top-color: inherit;
animation: downloadArrow 2s linear infinite;
animation-play-state: paused;
}
.buttonFileDownload:hover:before {
border-color: black;
}
.buttonFileDownload:hover:after {
border-top-color: black;
animation-play-state: running;
}
/* keyframes for the download icon anim */
#keyframes downloadArrow {
/* 0% and 0.001% keyframes used as a hackish way of having the button frozen on a nice looking frame by default */
0% {
margin-top: -14px;
opacity: 1;
}
0.001% {
margin-top: -30px;
opacity: 0;
}
50% {
opacity: 1;
}
100% {
margin-top: 0;
opacity: 0;
}
}
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Numbers</u><br/>
Numbers description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Colours</u><br/>
Colours description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Onomatopoeia</u><br/>
Onomatopoeia description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Alphabet</u><br/>
Alphabet description</a>
</div>
You should add a width to your container and width 100% on your buttons:
/*File download button*/
.buttonFileDownload_container {
text-align: center;
margin-bottom: 20px;
width: 400px;
}
.buttonFileDownload {
width: 100%;
display: inline-block;
position: relative;
padding: 10px 60px;
background-color: transparent;
border: 3px solid black;
color: black;
text-decoration: none!important;
font-size: 1.5em;
line-height: 1.2;
text-align: center;
text-indent: 15px;
}
.buttonFileDownload:before,
.buttonFileDownload:after {
content: ' ';
display: block;
position: absolute;
left: 10px;
top: 52%;
}
/* Download box shape */
.buttonFileDownload:before {
width: 20px;
height: 4px;
border-style: solid;
border-width: 0 4px 4px;
}
/* Download arrow shape */
.buttonFileDownload:after {
width: 0;
height: 0;
margin-left: 6px;
margin-top: -140px;
border-style: solid;
border-width: 8px 8px 0 8px;
border-color: transparent;
border-top-color: inherit;
animation: downloadArrow 2s linear infinite;
animation-play-state: paused;
}
.buttonFileDownload:hover:before {
border-color: black;
}
.buttonFileDownload:hover:after {
border-top-color: black;
animation-play-state: running;
}
/* keyframes for the download icon anim */
#keyframes downloadArrow {
/* 0% and 0.001% keyframes used as a hackish way of having the button frozen on a nice looking frame by default */
0% {
margin-top: -14px;
opacity: 1;
}
0.001% {
margin-top: -30px;
opacity: 0;
}
50% {
opacity: 1;
}
100% {
margin-top: 0;
opacity: 0;
}
}
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Numbers</u><br/>
Numbers description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Colours</u><br/>
Colours description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Onomatopoeia</u><br/>
Onomatopoeia description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Alphabet</u><br/>
Alphabet description</a>
</div>
Why don't you only use 1 container with a specific with, lets say 200px and make the buttons width 100%?
.buttonFileDownload_container {
width: 200px;
text-align: center;
margin-bottom: 20px;
}
.buttonFileDownload {
width: 100%;
display: inline-block;
position: relative;
padding: 10px 60px;
background-color: transparent;
border: 3px solid black;
color: black;
text-decoration: none!important;
font-size: 1.5em;
line-height: 1.2;
text-align: center;
text-indent: 15px;
}
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Numbers</u><br/>
Numbers description</a>
<a href="#" class="buttonFileDownload"><u>Colours</u><br/>
Colours description</a>
<a href="#" class="buttonFileDownload"><u>Onomatopoeia</u><br/>
Onomatopoeia description</a>
<a href="#" class="buttonFileDownload"><u>Alphabet</u><br/>
Alphabet description</a>
</div>
/*File download button*/
.buttonFileDownload_container {
text-align: center;
margin-bottom: 20px;
}
.buttonFileDownload {
display: inline-block;
position: relative;
padding: 10px 60px;
background-color: transparent;
border: 3px solid black;
color: black;
text-decoration: none!important;
font-size: 1.5em;
line-height: 1.2;
text-align: center;
text-indent: 15px;
width:260px;
}
.buttonFileDownload:before,
.buttonFileDownload:after {
content: ' ';
display: block;
position: absolute;
left: 10px;
top: 52%;
}
/* Download box shape */
.buttonFileDownload:before {
width: 20px;
height: 4px;
border-style: solid;
border-width: 0 4px 4px;
}
/* Download arrow shape */
.buttonFileDownload:after {
width: 0;
height: 0;
margin-left: 6px;
margin-top: -140px;
border-style: solid;
border-width: 8px 8px 0 8px;
border-color: transparent;
border-top-color: inherit;
animation: downloadArrow 2s linear infinite;
animation-play-state: paused;
}
.buttonFileDownload:hover:before {
border-color: black;
}
.buttonFileDownload:hover:after {
border-top-color: black;
animation-play-state: running;
}
/* keyframes for the download icon anim */
#keyframes downloadArrow {
/* 0% and 0.001% keyframes used as a hackish way of having the button frozen on a nice looking frame by default */
0% {
margin-top: -14px;
opacity: 1;
}
0.001% {
margin-top: -30px;
opacity: 0;
}
50% {
opacity: 1;
}
100% {
margin-top: 0;
opacity: 0;
}
}
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Numbers</u><br/>
Numbers description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Colours</u><br/>
Colours description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Onomatopoeia</u><br/>
Onomatopoeia description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Alphabet</u><br/>
Alphabet description</a>
</div>
Make a container . Set its width to the width you want for each button to have. Make width of all div inside it to 100%
Make width of all a tag inside that div to 100%
Simple
/*File download button*/
#container {
width: 200px;
}
#container > div {
width:100%;
}
#container > div > a {
width:100%;
}
.buttonFileDownload_container {
text-align: center;
margin-bottom: 20px;
}
.buttonFileDownload {
display: inline-block;
position: relative;
padding: 10px 60px;
background-color: transparent;
border: 3px solid black;
color: black;
text-decoration: none!important;
font-size: 1.5em;
line-height: 1.2;
text-align: center;
text-indent: 15px;
}
.buttonFileDownload:before,
.buttonFileDownload:after {
content: ' ';
display: block;
position: absolute;
left: 10px;
top: 52%;
}
/* Download box shape */
.buttonFileDownload:before {
width: 20px;
height: 4px;
border-style: solid;
border-width: 0 4px 4px;
}
/* Download arrow shape */
.buttonFileDownload:after {
width: 0;
height: 0;
margin-left: 6px;
margin-top: -140px;
border-style: solid;
border-width: 8px 8px 0 8px;
border-color: transparent;
border-top-color: inherit;
animation: downloadArrow 2s linear infinite;
animation-play-state: paused;
}
.buttonFileDownload:hover:before {
border-color: black;
}
.buttonFileDownload:hover:after {
border-top-color: black;
animation-play-state: running;
}
/* keyframes for the download icon anim */
#keyframes downloadArrow {
/* 0% and 0.001% keyframes used as a hackish way of having the button frozen on a nice looking frame by default */
0% {
margin-top: -14px;
opacity: 1;
}
0.001% {
margin-top: -30px;
opacity: 0;
}
50% {
opacity: 1;
}
100% {
margin-top: 0;
opacity: 0;
}
}
<div id="container">
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Numbers</u><br/>
Numbers description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Colours</u><br/>
Colours description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Onomatopoeia</u><br/>
Onomatopoeia description</a>
</div>
<div class="buttonFileDownload_container">
<a href="#" class="buttonFileDownload"><u>Alphabet</u><br/>
Alphabet description</a>
</div>
<div>
Related
Im honestly not sure what the heck happened when I changed the position from relative to absolute. Most of my elements were in absolute already. But changing the header, footer, and main section messed up the heights and visibility. Im not sure what to do. Im not even sure what to look for [for solutions] so Stack Overflow is my last resort.
My site for reference: https://rosesystem.neocities.org/index.html
No matter what % value I put in, the height doesnt change for the footer and the main box.
The CSS and The HTML:
background-image:url(Backgrounds/roses.gif);
Font-family: "Courier New", monospace;
}
.all {
margin-left: 25%;
margin-right: 25%;
margin-top: 2%;
align-items: center;
align-content: center;
justify-content: center;
height: 110%;
position: relative;
}
a {
color: red;
text-decoration: none;
}
a:hover {
color: darkred;
}
#top {
color: white;
justify-content: center;
font-size: 35px;
background-image:url(Backgrounds/rouge.JPG);
background-position: center;
background-size: fill;
border: 4px red solid;
display: flex;
align-items: center;
align-content: center;
padding: 5px;
width: 100%;
animation: mymove 5s infinite;
position: absolute;
}
#booty {
background-image:url(https://64.media.tumblr.com/6382d38a81b616031c469d56a09d88b4/7faacc6c2b3eb254-76/s500x750/fe9ff85c4a3590a3701990dd6182b40706df862e.gifv); /*background*/
color: white; font-size:20px; /*text*/
border: 4px red solid; /*border*/
justify-content: center; align-items: center; align-content: center; /*content position*/
padding-top: 20px; margin-top: 12.5%!important; margin-bottom: 1%; margin: 20%; position: absolute; /*container position*/
padding: 5px; width: 60%; height: 200%; /*dimensions*/
animation: mymove 5s infinite;
}
#keyframes mymove {
0% {border-color: red;}
50% {border-color: darkred;}
100% {border-color: red}
}
#feet {
background-image:url(Backgrounds/rouge.JPG);
color: white; font-size: 20px;
Border: 4px red solid;
Padding: 5px; width: 60%; height: 100%;
margin-top: 85%!important;margin-bottom: 5%!important; margin: 20%; /*container position*/
animation: mymove 5s infinite;
position: absolute;
}
.sidebar {
Border: 4px red solid;
animation: mymove 5s infinite;
background-color: black;
height: 100%
float: left;
margin-left: none;
margin-right: 82%!important;
overflow: hidden;
margin-top: 12.5%;
position: absolute;
left: 0;
top: 0;
padding: 5px;
padding-top: 20px!important;
align-items: center;
align-content: center;
justify-content: center;
}
.sidebar a {
display: block;
padding-top: 10px;
font-size: 20px;
background-color: #540101;
}
#otherside {
background-color: black;
color: white; font-size: 20px;
Border: 4px red solid; Padding: 5px;
position: absolute;
animation: mymove 5s infinite;
margin-left: 84% ;
width: 16.2%;
margin-top: 12.5%;
height: 100%;
}
#othersidetext {
background-color: #540101;
text-align: center;
color: red;
}
#othersideimg {
Border: 4px red solid;
height: auto; width: 93%;
animation: mymove 5s infinite;
margin-top: 4.5%;
}
#countbox {
background-image:url(Backgrounds/rouge.JPG);
color: white; font-size: 20px;
Border: 4px red solid; Padding: 5px;
position: absolute;
animation: mymove 5s infinite;
margin-left: 84%;
width: 16.2%;
margin-top: 49.5%;
height: 7%;
}
#blinkiebox {
background-color: black;
color: white; font-size: 20px;
Border: 4px red solid; Padding: 5px;
position: absolute;
animation: mymove 5s infinite;
margin-left: 84%;
width: 16.2%;
margin-top: 38.7%;
height: 35%;
overflow: hidden;
}
#blinkies {
width: 103%;
margin-left: 84%;
height: auto;
}
hr {
border-color: red;
border-style: solid;
border-width: 2px;
width: 106%;
margin-left: -5%;
animation: mymove 5s infinite;
}
</style>
<body>
<!-- everything box -->
<div class="all">
<!-- title box -->
<div id="top"> The Rose System </div>
<!-- main box -->
<div id="booty">
yes i'm redoing the index page again shh<br>
test<br>test<br>ok<br>now<br>here<br>Is<br>placeholder<br>text<br>i<br>hope<br>you<br>enjoy<br>
<img src="Roses/groupofroses.gif" alt="group of pretty roses with a butterfly" width="40%" height="auto"><br>
</div>
<!-- footer box -->
<div id="feet"> <marquee> || site by achrya || Feb 2022-Forever ||</marquee> </div>
<!-- sidebar box -->
<div class="sidebar">
<img src="Roses/groupofroses.gif" alt="group of pretty roses with a butterfly" width="75%" height="auto">
<hr>
<img src="Roses/rosedivider2.GIF" alt="horizontal rose vine that divides a section" width="97%" height="auto">
<hr>
Alter List
<hr>
Blog
<hr>
General [TW: Flashing]
<hr>
Links
<hr>
<img src="Roses/rosedivider2.GIF" alt="horizontal rose vine that divides a section" width="97%" height="auto" padding-bottom="15px">
<hr>
<img src="Roses/groupofroses.gif" alt="group of pretty roses with a butterfly" width="75%" height="auto">
</div>
<!-- image box -->
<div id=otherside>
<div id="othersidetext"> Zombie: </div>
<hr>
<img src="https://c.tenor.com/8ustcfbXeAcAAAAM/anime-excited.gif" id="othersideimg" alt="a gif of the system host, zombie. from one of her source medias">
</div>
<!-- count box -->
<div id="countbox">Alter Count: 13?</div>
<!-- Blinkie Box -->
<div id="blinkiebox">
<img src="Blinkies/Guestbook.gif" id="blinkies" padding-top="5%">
<hr>
<img src="Blinkies/dicesurvivor.PNG" id="blinkies">
<hr>
<img src="Blinkies/achrya.gif" id="blinkies" width="110%!important" height="auto">
<hr>
<img src="Blinkies/osdid.gif" id="blinkies">
</div>
</div>
When you use height: 100%; on your Footer, that basically means to get a 100% of height of the nearest parent with absolute or relative position. In your case it's an <div class="all" element.
The problem that you have is that <div class="all" element has a height of 0.
You can choose one of these options to fix the issue:
Add height to your all element
.all {
height: 100vh;
}
Make your all element also absolute, and then it takes the height automatically
.all {
position: absolute;
width: 50%;
}
So as said above, I have (for fun) recreated a website (hologram.io), because I'm new to CSS, and just wanted to see what I can do myself without help... But I can't figure out how I can position the whole first section which is absolute (-> On top of an Image) center, center. So vertical and horizontal, So that on bigger screens it always stays perfectly in the center of the menu... On the other sections which are not absolute, I used display: flex, justify-content: center and align-items center, which works perfectly... On the screenshots I have included, you can see the problem... Also, will include the code. It looks a bit messy, but should be fine haha...
Here you can see the noncentered Absolute item
Here you can see the flex items which are perfectly centered on every screensize and
And here for Refernce is the hologram website...
#font-face {
font-family: Robert Sans;
src: url(RobertSans-Regular.ttf);
}
#navtextonly li {
list-style-type: none;
display: inline;
padding: 15px;
text-align: center;
}
.listitem:hover {
cursor: pointer;
color: #4e6cff;
}
#hologramlogo {
margin-top: 20px;
margin-bottom: 20px;
margin-right: 0px;
padding-right: 0px;
}
nav {
background-color: rgb(255, 255, 255);
}
body {
margin: 0px;
font-family: Robert Sans;
}
#navbarouter {
display: flex;
align-items: center;
justify-content: center;
}
#navtextonly {
white-space: nowrap;
}
#mainmenuwobtnlogo {
margin-right: 100px;
}
ul {
font-size: 16px;
}
#buttonsmenu1 {
background-color: white;
border: 1px solid #4e6cffce;
padding: 12px 23px 12px 23px;
border-radius: 25px;
margin-right: 15px;
-webkit-box-shadow: 2px 2px 15px 1px #999999;
box-shadow: 2px 2px 15px 1px #999999;
}
#buttonsmenu1:hover {
border-color: #111;
cursor: pointer;
}
#buttonsmenu2 {
background-color: #4e6cff;
padding: 12px 23px 12px 23px;
color: white;
border-radius: 25px;
-webkit-box-shadow: 2px 2px 15px 1px #999999;
box-shadow: 2px 2px 15px 1px #999999;
}
#buttonsmenu2:hover {
background-color: #788fff;
color: white;
cursor: pointer;
}
.buttonsmenuouter {
margin-left: 25px;
}
#hamburgernav {
display: none;
}
#backgroundverlauf {
height: 800px;
width: 100%;
background-size: cover;
background-repeat: no-repeat;
}
.mainheading {
font-size: 64px;
white-space: nowrap;
font-weight: 400;
}
#h1top,
#h1bottom {
margin: 0px;
padding: 0px;
}
article {
color: rgb(255, 255, 255);
max-width: 550px;
}
#ellipse {
position: absolute;
top: 0px;
left: 630px;
}
#drohnepng {
position: absolute;
top: -50px;
left: 880px;
height: 80px;
}
#cartpng {
position: absolute;
top: 80px;
left: 585px;
height: 250px;
}
#rollerpng {
position: absolute;
top: 140px;
left: 825px;
height: 440px;
}
#content1 {
position: absolute;
top: 250px;
left: 12%;
}
#outerouter {
max-width: 1300px;
}
#glowh1 {
background: linear-gradient(
-60deg,
#904e95,
#904e95,
#e73c7e,
#ee7752,
#4e6cff,
white
);
background-size: 600%;
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
animation: animate 10s linear infinite;
}
#keyframes animate {
0% {
background-position: 0%;
}
100% {
background-position: 600%;
}
}
#paragraph {
width: 390px;
color: rgb(199, 199, 199);
font-size: 20px;
margin-bottom: 30px;
}
#emailwithsubmit {
display: flex;
}
.emailfeld {
width: 100%;
padding: 18px 23px 18px 23px;
border-radius: 25px 26px 26px 25px;
border-width: 0px;
border: 1px red solid;
}
#submitbtn {
padding: 18px 35px 18px 35px;
border-radius: 25px 25px 25px 25px;
color: white;
font-weight: 600;
border-width: 0px;
background-image: linear-gradient(90deg, #00a6ff, #7831ca, #fe17c0);
position: relative;
left: -60px;
}
#mainpart2,
#mainpart3 {
display: flex;
align-items: center;
justify-content: center;
margin: 100px 60px 100px 60px;
}
#mainpart2-3outer {
}
#card {
margin-left: 60px;
margin-right: 100px;
height: 280px;
/* -webkit-animation: fadein 3.2s both;
-moz-animation: fadein 3.2s both;
-o-animation: fadein 3.2s both;
animation: fadein 3.2s both; */
animation: float2 6s ease-in-out infinite;
}
#keyframes float2 {
0% {
transform: translatey(0px);
}
50% {
transform: translateX(-10px);
}
100% {
transform: translatey(0px);
}
}
#-webkit-keyframes fadein {
0% {
opacity: 0;
-webkit-transform: translateX(-25px);
}
100% {
opacity: 1;
-webkit-transform: translateX(0);
}
}
#-moz-keyframes fadein {
0% {
opacity: 0;
-moz-transform: translateX(-50px);
}
100% {
opacity: 1;
-moz-transform: translateX(0);
}
}
#-0-keyframes fadein {
0% {
opacity: 0;
-o-transform: translateX(-50px);
}
100% {
opacity: 1;
-o-transform: translateX(0);
}
}
#keyframes fadein {
0% {
opacity: 0;
transform: translateX(-50px);
}
100% {
opacity: 1;
transform: translateX(0);
}
}
#ellipse {
-webkit-animation: fade 5s both;
-moz-animation: fade 5s both;
-o-animation: fade 5s both;
animation: fade 5s both;
}
#-webkit-keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-moz-keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-0-keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#cartpng,
#drohnepng,
#rollerpng {
/* -webkit-animation: fadein 3.2s both;
-moz-animation: fadein 3.2s both;
-o-animation: fadein 3.2s both;
animation: fadein 3.2s both;
transform: translatey(0px); */
animation: float 6s ease-in-out infinite;
}
#keyframes float {
0% {
transform: translatey(0px);
}
50% {
transform: translatey(-50px);
}
100% {
transform: translatey(0px);
}
}
#mainh-1,
#mainp-1 {
max-width: 280px;
}
#mainh-2,
#mainp-2 {
max-width: 280px;
}
.main1h,
.main1p,
.main2h,
.main2p {
display: flex;
flex-direction: row;
justify-content: space-between;
}
#mainh-3,
#mainp-3 {
max-width: 280px;
}
#mainh-4,
#mainp-4 {
max-width: 280px;
}
#mainh-1,
#mainh-2,
#mainh-3,
#mainh-4 {
margin: 0px;
padding: 0px;
}
#textmainpart2 {
margin-right: 60px;
}
.main2h1 {
margin-bottom: 40px;
}
.contentmainpart3-1 {
max-width: 475px;
margin-left: 60px;
}
.contentmainpart3-2 {
margin-right: 60px;
}
#beforefootercentered {
text-align: center;
margin-bottom: 75px;
}
.beforefootercolumncontent {
display: flex;
flex-direction: row;
justify-content: center;
gap: 100px;
margin-left: 100px;
margin-right: 100px;
margin-bottom: 50px;
}
.beforefootericons {
height: 66px;
width: 66px;
}
#beforefootercolumncontent1,
#beforefootercolumncontent2,
#beforefootercolumncontent3 {
max-width: 280px;
text-align: center;
}
#list2banner {
display: flex;
flex-direction: row;
margin-top: 20px;
}
#list1bannerouter {
max-width: 725px;
}
.footerbanner {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
background-image: linear-gradient(90deg, #7831ca, #00a5ff);
margin: 0px 190px 0px 190px;
border-radius: 10px;
padding-left: 30px;
padding-top: 25px;
padding-right: 30px;
padding-bottom: 50px;
color: white;
position: relative;
top: 100px;
}
.footerbanner h2 {
font-size: 40px;
font-weight: 400;
margin-bottom: 10px;
}
#list1banner {
margin: 0;
padding: 0;
list-style: none;
display: flex;
}
#list1banner li:before {
content: "✓";
padding-right: 5px;
}
#btn1,
#btn2 {
border-radius: 25px;
padding: 10px 20px 10px 20px;
}
#btn1 {
margin-right: 20px;
background-color: #111;
border-width: 0px;
}
#btn2 {
background-image: transparent;
border: 1px solid white;
}
#pfeil {
margin-left: 5px;
}
#mainfooter {
height: 600px;
background-color: #0a1435;
}
#mainfooterupper {
height: 100px;
background-color: #0a1435;
display: none;
}
.item1 {
margin-right: 20px;
}
#placehold {
position: absolute;
top: 3100px;
left: 50%;
transform: translate(-50%, -50%);
color: rgb(255, 255, 255);
font-size: 70px;
}
#media only screen and (max-width: 1350px) {
html,
body {
overflow-x: hidden;
}
body {
position: relative;
}
#navtextonly {
font-size: 14px;
}
li {
padding-right: 20px;
}
#mainmenuwobtnlogo {
margin-left: 0px;
margin-right: 0px;
}
#navbarouter {
display: flex;
}
#hologramlogo {
margin-top: 20px;
margin-bottom: 20px;
margin-left: 0px;
width: 120px;
}
.buttonsmenuouter {
margin-left: 25px;
font-size: 14px;
margin-right: 0px;
}
#buttonsmenu1,
#buttonsmenu2 {
padding: 9px 17px 9px 17px;
}
#backgroundverlauf {
height: 800px;
width: 100%;
background-size: cover;
background-repeat: no-repeat;
}
}
#media only screen and (max-width: 990px) {
html,
body {
overflow-x: hidden;
}
body {
position: relative;
}
#navtextonly {
display: none;
}
#navbarouter {
margin-left: 20px;
margin-right: 20px;
display: flex;
justify-content: space-between;
}
#hologramlogo {
margin-top: 20px;
margin-bottom: 20px;
margin-left: 20px;
}
.buttonsmenuouter {
margin-left: 0px;
}
#hamburgernav {
margin-top: 20px;
margin-bottom: 20px;
margin-left: 20px;
margin-right: 20px;
display: inline;
}
#backgroundverlauf {
height: 800px;
width: 100%;
background-size: cover;
background-repeat: no-repeat;
}
.mainheading {
font-size: 50px;
}
#paragraph {
font-size: 19px;
}
}
#media only screen and (max-width: 570px) {
.mainheading {
font-size: 30px;
}
#paragraph {
font-size: 16px;
}
#content1 {
position: absolute;
top: 175px;
}
article {
color: rgb(255, 255, 255);
max-width: 500px;
display: flex;
flex-direction: column;
margin-right: 20px;
}
#floatingimages {
display: none;
}
#paragraph {
width: 300px;
color: rgb(199, 199, 199);
font-size: 16px;
margin-bottom: 30px;
}
#backgroundverlauf {
height: 500px;
}
.emailfeld {
width: 80%;
padding-bottom: 20px;
padding: 13px 20px 13px 20px;
border-radius: 25px 26px 26px 25px;
border-width: 0px;
border: 1px red solid;
}
#submitbtn {
width: 87%;
position: absolute;
left: 10px;
top: 280px;
padding-bottom: 20px;
padding: 13px 20px 13px 20px;
border-radius: 25px 26px 26px 25px;
border-width: 0px;
border: 1px red solid;
/*
padding: 13px 30px 13px 30px;
border-radius: 25px 25px 25px 25px;
color: white;
font-weight: 600;
margin-left: 0px;
border-width: 0px;
background-image: linear-gradient(90deg, #00a6ff, #7831ca, #fe17c0);*/
}
#emailwithsubmit {
display: flex;
gap: 13px;
flex-direction: column;
align-items: center;
}
}
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="styles2.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Index2</title>
</head>
<div>
<nav>
<div id="navbarouter">
<img
id="hologramlogo"
src="610f51dabc2bd752a968dfac_Hologram Logo Black Text.svg"
alt="Logo"
width="130px"
/>
<ul id="navtextonly">
<li class="listitem">Cellular IoT</li>
<li class="listitem">Why Hologram</li>
<li class="listitem">Resources</li>
<li class="listitem">Plans</li>
<li class="listitem">Jobs</li>
<li class="listitem">Store</li>
<span class="buttonsmenuouter">
<li id="buttonsmenu1">Contact Sales</li>
<li id="buttonsmenu2">Sign in</li>
</span>
</ul>
<div id="hamburgernavouter">
<img id="hamburgernav" src="hamburgernav.svg" alt="hamburgernav" />
</div>
</div>
</nav>
<div id="outerouterouter">
<img
src="background1.png"
id="backgroundverlauf"
alt="backgroundverlauf"
/>
<div id="outerouter">
<div id="content1">
<article>
<h1 class="mainheading" id="h1top">Internet everywhere.</h1>
<p class="mainheading" id="h1bottom">For every<span id="glowh1">thing</span>.</p>
<p id="paragraph">Spend less time monitoring your IoT deployments and more time innovating. Hologram's cellular platform enables you to connect and manage any device, anywhere in the world.</p>
<div id="emailwithsubmit">
<input type="email" class="emailfeld" autocomplete="email" maxlength="256" name="Email" data-name="Email" placeholder="E-Mail-Adresse" id="email" data-validation="email required email length" required="" data-validation-event="keyup change" data-validation-length="max256">
<input type="submit" value="Get started" data-wait="Please wait..." class="c-button is--gradient w-button disabled" disabled="disabled" id="submitbtn">
</div>
</article>
<div id="floatingimages">
<img class="sideimages" id="ellipse" src="backgroundellipse.png" alt="ellipse">
<img class="sideimages" id="drohnepng" src="drohne.png" alt="drohne">
<img class="sideimages" id="cartpng" src="cart.png" alt="cart">
<img class="sideimages" id="rollerpng" src="roller.png" alt="roller">
</div>
</div>
</div>
</div>
<div id="mainpart2-3outer">
<div id="mainpart2">
<div id="cardcontainer">
<img id ="card" src="card.png" alt="card">
</div>
<div id="textmainpart2">
<h1 class="main2h1"> Testüberschrift: global IoT connectivity platform</h1>
<div class="main1h">
<h2 id="mainh-1">One global SIM card</h2>
<h2 id="mainh-2">Automatic carrier switching</h2>
</div>
<div class="main1p">
<p id="mainp-1">Connect to 470+ networks in 200 countries using a single hardware-agnostic SIM card or eSIM eUICC chip. </p>
<p id="mainp-2">Hologram SIMs automatically switch between local carriers to ensure you have top performance and never lose service.</p>
</div>
<div class="main2h">
<h2 id="mainh-3">Flexible, scalable pricing</h2>
<h2 id="mainh-4">Connectivity tools for your team</h2>
</div>
<div class="main2p">
<p id="mainp-3">No contracts, quotas, or negotiations. Activate, change, or pause plans anytime via our Hologram Dashboard or APIs.</p>
<p id="mainp-4">Collaboratively manage your fleet with ease via our easy-to-use Dashboard or our modern REST API.</p>
</div>
</div>
</div>
<div id="mainpart3">
<div class="contentmainpart3-1">
<img src="hyper.svg" alt="hyper">
<h1>Testüberschrift2: flexibility and coverage with Hyper</h1>
<p>Future-proof your SIMs and scale faster globally with Hyper, Hologram’s eUICC SIMs and platform. Hyper provides over-the-air, updatable access to Hologram’s full portfolio of IoT connectivity partners and profiles.</p>
<p>What is Hyper? --></p>
</div>
<div class="contentmainpart3-2">
<img src="image maincontent3.png" alt="ballwiththingsmainpart3right" height= "570px">
</div>
</div>
</div>
<div id="beforefootercentered">
<h1>Scaling connectivity has never been so easy</h1>
<p>The simplest way to get your IoT deployment connected worldwide.</p>
</div>
<div class="beforefootercolumncontent">
<div id="beforefootercolumncontent1">
<img src="antenne.svg" loading="lazy" alt="cell tower icon" class="beforefootericons">
<h3 class="">No hassles or headaches</h3>
<p class="">Focus on your product and data — not connectivity infrastructure, negotiations, and pricing.</p>
</div>
<div id="beforefootercolumncontent2">
<img src="speedometer.svg" loading="lazy" alt="dashboard icon" class="beforefootericons">
<h3 class="">Ready to grow your business</h3>
<p class="">Manage global deployments from a single connectivity platform with pricing that scales as you do.</p>
</div>
<div id="beforefootercolumncontent3">
<img src="settings.svg" loading="lazy" alt="gear icon" class="beforefootericons">
<h3 class="">All the tools you need</h3>
<p class="">Our Hologram Dashboard, REST API, and supported hardware make integrating connectivity easy.</p>
</div>
</div>
<footer>
<div id="mainfooterupper"></div>
<div class="footerbanner">
<div id="list1bannerouter">
<h2>Try Hologram today.</h2>
<ul id="list1banner">
<li class="item1">Free Sim</li>
<li class="item1">1 MB/mo free</li>
<li>Connect and scale in days</li>
</ul>
</div>
<div id="list2banner">
<div id="btn1">Sign up free<img id="pfeil" src="pfeil.svg"></div>
<div id="btn2">Contact sales <img id="pfeil" src="pfeil.svg"></div>
</div>
</div>
<div id="mainfooter">
<h1 id="placehold">Footer Items Soon</h1>
</div>
</footer>
</main>
</body>
</html>
Use this to your container[absolute] element
.container{
position: absolute;
/* For Vertically center */
top: 50%;
transform: translateY(-50%);
/* For Horizontally center */
left: 50%;
transform: translateX(-50%);
}
If You're using height and width without positioning use this
.container{
--height: 100px;
height: var(--height);
/* Horizontally Center */
margin: auto;
/* Vertically Center */
margin-top: calc(50% - var(--height));
}
I have a particular page on my website (http://thefloodplains.com/TheFloodSharkMain.html) whereby I have 6 DIV boxes that I want to be clickable to take users to other areas of the site. So far I've been able to wrap the header text I have within the DIVs with links. However, I have been unable to wrap the DIVs, themselves, in links. Every time I put an a href="..." around the DIV boxes, nothing happens. This might have to do with the fact that images have been overlain on top of the DIVs, but I'm not exactly sure.
Additionally, since I want the DIVs to have links and be clickable, I would like them to fade a certain color (with translucent opacity) when hovered over. Basically, I want the boxes on this page to act the exact same as they do on my front page: .
What makes this hard is that I'm positioning it in a different area of the page, and the original code doesn't seem to work in this case. I've tried most everything I can think of without having to entirely retry and tear down all the code I've been using. As it stands, I cannot get the hover actions or links around the DIVs to react at all.
The code I have been working with to fade each DIV to a specified color (in this case an orange-yellow shade) looks like this:
.block:after {
content: '';
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: block;
background: #FFE097;
opacity: 0;
}
.block:hover:after {
opacity: .5;
}
Here's the overall CSS I'm working with
h2 {
padding-bottom: 20px;
font-size: 40px;
margin-bottom: 10px;
color:#FF8B6F;
text-decoration-color: #FF8B6F;
}
h4.shoe {
font-size:36px;
font-style: bold;
text-align:center;
font-family:'Buernard', Garamond, "Buenard", "EB Garamond",'EB Garamond';
text-decoration-color: #00A5D1;
color: #00A5D1;
}
a {
border-bottom: dashed 1px;
text-decoration-color: #FF8B6F;
border-bottom: 1px dashed #FF8B6F;
text-decoration: none;
}
u {
border-bottom: 1px dashed #00A5D1;
text-decoration: none;
}
u:hover {
Color: #FF8B6F;
border-bottom: solid 2px;
}
.flex-container {
display: flex;
flex-wrap: wrap;
max-width: 960px;
width: 100%;
padding-top: 15px;
}
.block {
flex: 0 0 33.1%;
height: 300px;
background-color: #00A5D1;
background-position: center center; /* center the image in the div */
background-size: cover; /* cover the entire div */
background-repeat: no-repeat;
background-size: 100%;
border: 1px solid #FF8B6F;
/* align-items: center;
justify-content: center; */
text-align: center;
}
/* .block:after {
content: '';
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: block;
background: #FFE097;
opacity: 0;
}
.block:hover:after {
opacity: .5;
} */
x {
margin: auto;
text-align: center;
font-size: 85px;
font-family: 'Gentium Basic', Verdana, 'Slabo 27px', 'Vollkorn', serif;
padding: 6px;
margin: 6px;
text-decoration-color:#00A5D1;
color:#00A5D1;
border-bottom: 2px solid #FFE097;
}
hr {
border: none;
height: 2px;
color: black;
background-color: #FFE097;
margin-bottom: 33px;
}
p {
color: black;
text-align: left;
width: 100%;
max-width: 90%;
margin-left: auto;
margin-right: auto;
font-family: 'Buenard', Garamond, 'EB Garamond';
}
hr.two {
margin-bottom: 16px;
}
ul {
padding-bottom: 0px;
margin-bottom: 6px;
padding-top: 12px;
}
br {
padding-bottom: 6px;
}
li.pad {
padding-bottom: 6px;
margin-bottom: 6px;
}
div {
color: #00A5D1;
padding-top: 14px;
}
df {
text-decoration: inherit;
text-decoration: none;
}
.Row
{
display: table;
width: 100%; /*Optional*/
max-width: 960px;
table-layout: fixed; /* Optional*/
border-spacing: 10px; /* Optional */
margin-left: auto;
margin-right: auto;
}
a.none {
text-decoration: none;
}
.blockx {
background-image: url('DownloadMusic2.png');
}
.blockx:hover {
background-color: #FFE097;
}
.blockx:after {
display: block;
background: #FFE097;
opacity: 0;
}
.blockx:hover:after {
opacity: .5;
}
.blocky {
background-image: url('EPKIcon2.png');
background-position: center center;
}
.blocky:hover {
background-color: #FFE097;
}
.blockz {
background-image: url('StreamAudio.png');
}
.blocka {
background-image: url('VideoStream.png');
background-position: center center;
}
.blockb {
background-image: url('ContactIcon.png');
}
.blockc {
background-image: url('Handshake2.png');
}
And here is the HTML of the web page:
<body>
<a class="btn" href="http://thefloodplains.com/"></a>
<center><x>The FloodShark</x></center>
<br>
<center><df href="http://www.thegrassrootsgarage.com/wp-content/uploads/2016/02/FloodShark-cropped-William-Luo.jpg" style="text-decoration: none;"><img src="http://www.thegrassrootsgarage.com/wp-content/uploads/2016/02/FloodShark-cropped-William-Luo-1024x585.jpg" style="margin-top: 0px; margin-bottom: 2px; padding-bottom: 6px" alt="floodshark-cropped-william-luo" width="856" height="480" class="alignnone size-large wp-image-228" padding-bottom="2px;" /></img></df></center>
<hr>
<p><b>The FloodShark:</b> A Florida-based producer/composer turned carnivorous, fresh-water tolerant, cold-blooded, cartilaginous predator surfing the sonic waves with an eclectic musical style</p>
<center><div class="container flex-container">
<div class="block blockx"><a href="TheFloodSharkDownloads.html"><h4 class='shoe'><u>Downloads</u></h4></div></a>
<div class="block blocky"><a href="EPK.html"><h4 class='shoe'><u>EPK</u></h4></div></a>
<div class="block blockz"><h4 class='shoe'><u>Stream Audio</u></h4></div>
<div class="block blocka"><h4 class='shoe'><u>Stream Video</u></h4></div>
<div class="block blockb"><h4 class='shoe'><u>Contact</u></h4></div>
<div class="block blockc"><h4 class='shoe'><u>Contribute / Support</u></h4></div>
</div></center>
<br>
</body>
So basically I want to be able to use the boxes as is, but I would like to make it so that the entire DIV box for each box is a link, as well as fades to a shade of a specified color when hovered over. Thank you in advance for any and all advice!
Try this html markup. Donot try to add anchors inside anchor ! it doesn't work.
Also you have missed styles for hover on blockz, blocka, blockb and blockc. That is why no hover effect is shoeing on them.
See updated fiddle https://jsfiddle.net/owvs550p/4/
<a class="btn" href="http://thefloodplains.com/"></a>
<center>
<x>The FloodShark</x>
</center>
<br>
<center>
<df href="http://www.thegrassrootsgarage.com/wp-content/uploads/2016/02/FloodShark-cropped-William-Luo.jpg" style="text-decoration: none;"><img src="http://www.thegrassrootsgarage.com/wp-content/uploads/2016/02/FloodShark-cropped-William-Luo-1024x585.jpg" style="width:100%;margin-top: 0px; margin-bottom: 2px; padding-bottom: 6px" alt="floodshark-cropped-william-luo" width="856" height="480" class="alignnone size-large wp-image-228" padding-bottom="2px;" /></img>
</df>
</center>
<hr>
<p><b>The FloodShark:</b> A Florida-based producer/composer turned carnivorous, fresh-water tolerant, cold-blooded, cartilaginous predator surfing the sonic waves with an eclectic musical style</p>
<center>
<div class="container flex-container">
<a href="TheFloodSharkDownloads.html" class="block" title="Free downloads of The FloodShark's discography">
<div class="block blockx">
<h4 class='shoe'><u>Downloads</u></h4>
</div>
</a>
<a href="EPK.html" class="block" title="EPK">
<div class="block blocky">
<h4 class='shoe'><u>EPK</u></h4>
</div>
</a>
<a href="" class="block">
<div class="block blockz">
<h4 class='shoe'><u>Stream Audio</u></h4>
</div>
</a>
<a class="block" href="https://www.youtube.com/channel/UCrcvj6Q-V4S-xad_Y_gPTFw/videos">
<div class="block blocka">
<h4 class='shoe'><u>Stream Video</u></h4>
</div>
</a>
<a href="Contact-Social.html" class="block">
<div class="block blockb">
<h4 class='shoe'><u>Contact</u></h4>
</div>
</a>
<a href="Contribute-Support.html" class="block">
<div class="block blockc">
<h4 class='shoe'><u>Contribute / Support</u></h4>
</div>
</a>
</div>
</center>
<br>
CSS
h2 {
padding-bottom: 20px;
font-size: 40px;
margin-bottom: 10px;
color:#FF8B6F;
text-decoration-color: #FF8B6F;
}
h4.shoe {
font-size:36px;
font-style: bold;
text-align:center;
font-family:'Buernard', Garamond, "Buenard", "EB Garamond",'EB Garamond';
text-decoration-color: #00A5D1;
color: #00A5D1;
}
a {
border-bottom: dashed 1px;
text-decoration-color: #FF8B6F;
border-bottom: 1px dashed #FF8B6F;
text-decoration: none;
}
u {
border-bottom: 1px dashed #00A5D1;
text-decoration: none;
}
u:hover {
Color: #FF8B6F;
border-bottom: solid 2px;
}
.flex-container {
display: flex;
flex-wrap: wrap;
max-width: 960px;
width: 100%;
padding-top: 15px;
}
.block {
flex: 0 0 33.1%;
height: 300px;
background-color: #9100ff;
background-position: center center; /* center the image in the div */
background-size: cover; /* cover the entire div */
background-repeat: no-repeat;
background-size: 100%;
border: 1px solid #FF8B6F;
/* align-items: center;
justify-content: center; */
text-align: center;
}
/* .block:after {
content: '';
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: block;
background: #FFE097;
opacity: 0;
}
.block:hover:after {
opacity: .5;
} */
x {
margin: auto;
text-align: center;
font-size: 85px;
font-family: 'Gentium Basic', Verdana, 'Slabo 27px', 'Vollkorn', serif;
padding: 6px;
margin: 6px;
text-decoration-color:#00A5D1;
color:#00A5D1;
border-bottom: 2px solid #FFE097;
}
hr {
border: none;
height: 2px;
color: black;
background-color: #FFE097;
margin-bottom: 33px;
}
p {
color: black;
text-align: left;
width: 100%;
max-width: 90%;
margin-left: auto;
margin-right: auto;
font-family: 'Buenard', Garamond, 'EB Garamond';
}
hr.two {
margin-bottom: 16px;
}
ul {
padding-bottom: 0px;
margin-bottom: 6px;
padding-top: 12px;
}
br {
padding-bottom: 6px;
}
li.pad {
padding-bottom: 6px;
margin-bottom: 6px;
}
div {
color: #00A5D1;
padding-top: 14px;
}
df {
text-decoration: inherit;
text-decoration: none;
}
.Row
{
display: table;
width: 100%; /*Optional*/
max-width: 960px;
table-layout: fixed; /* Optional*/
border-spacing: 10px; /* Optional */
margin-left: auto;
margin-right: auto;
}
a.none {
text-decoration: none;
}
.blockx {
background-image: url('DownloadMusic2.png');
}
.blockx:hover {
background-color: #FFE097;
}
.blockx:after {
display: block;
background: #FFE097;
opacity: 0;
}
.blockx:hover:after {
opacity: .5;
}
.blocky {
background-image: url('EPKIcon2.png');
background-position: center center;
}
.blocky:hover {
background-color: #FFE097;
}
.blockz {
background-image: url('StreamAudio.png');
}
.blocka {
background-image: url('VideoStream.png');
background-position: center center;
}
.blockb {
background-image: url('ContactIcon.png');
}
.blockc {
background-image: url('Handshake2.png');
}
EDIT
Add the following styles for the hover effect to work properly
.block {
position: relative;
}
.block:after {
content: '';
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: block;
background: #FFE097;
opacity: 0;
}
.block:hover:after {
opacity: 0.5;
}
I'm having trouble with setting a transition, At the moment it goes from top to bottom (It's a border that shows when you hover). I'd like the transition to start from the middle and to spread to the side or at least to start from any side and to spread to the other...
My navigation menu anchors are using the navigation-link class !
* {
margin: 0px;
font-family: Futura;
font-weight: 100;
-webkit-font-smoothing: antialiased;
color: white;
}
body {
background-image: url("../Media/body-bg.png");
}
/* NOTE: Class */
.navigation-box {
height: 60px;
width: 100%;
background-color: MediumSeaGreen;
position: fixed;
z-index: 1;
min-width: 800px;
}
.navigation-menu {
margin: 6px 15px;
float: left;
color: white;
}
.navigation-link {
padding: 6px 10px;
font-weight: 100 !important;
font-size: 23px;
padding-bottom: 12px;
text-decoration: none;
border-bottom: 0px solid DarkGreen;
transition: left 2s, all ease-in-out 300ms;
}
.navigation-link:hover {
color: Wheat;
border-bottom: 3px solid DarkGreen;
}
.vline {
border-left: 2px solid white;
padding-bottom: 6px;
margin: 0px 0px 0px 10px;
}
<!DOCTYPE html>
<html>
<head>
<title>Cabinet Psychologie | 15ème</title>
<link href="./Data/CSS/styling.css" rel="stylesheet" type="text/css">
</head>
<body noresize="noresize">
<div class="navigation-box">
<h1 class="navigation-menu">
Accueil<a class="vline"></a>
Cours<a class="vline"></a>
Plans<a class="vline"></a>
Plus
</h1>
</div>
</body>
</html>
So if you know a way to make it work it would be very much appreciated
You may consider a pseudo-element to create the border. First you set 50% in left/right property and on hover you switch to 0 both and this will create the effect you want:
* {
margin: 0px;
font-family: Futura;
font-weight: 100;
-webkit-font-smoothing: antialiased;
color: white;
}
body {
background-image: url("../Media/body-bg.png");
}
/* NOTE: Class */
.navigation-box {
height: 60px;
width: 100%;
background-color: MediumSeaGreen;
position: fixed;
z-index: 1;
min-width: 800px;
}
.navigation-menu {
margin: 6px 15px;
float: left;
color: white;
}
.navigation-link {
padding: 6px 10px;
font-weight: 100 !important;
font-size: 23px;
padding-bottom: 12px;
text-decoration: none;
border-bottom: 0px solid DarkGreen;
position: relative;
}
.navigation-link:before {
content: "";
position: absolute;
height: 3px;
bottom: 0;
left: 50%;
right:50%;
background:DarkGreen;
transition: all ease-in-out 300ms;
}
.navigation-link:hover {
color: Wheat;
}
.navigation-link:hover::before,.navigation-link.active:before {
left: 0;
right:0;
}
.vline {
border-left: 2px solid white;
padding-bottom: 6px;
margin: 0px 0px 0px 10px;
}
<!DOCTYPE html>
<html>
<head>
<title>Cabinet Psychologie | 15ème</title>
<link href="./Data/CSS/styling.css" rel="stylesheet" type="text/css">
</head>
<body noresize="noresize">
<div class="navigation-box">
<h1 class="navigation-menu">
<a href="#" class="navigation-link active" >Accueil</a>
<a class="vline"></a>
Cours
<a class="vline"></a>
Plans
<a class="vline"></a>
Plus
</h1>
</div>
</body>
</html>
You can use a pseudoelement instead of border.
To make it start from the middle, set left or right at 50% and give the pseudoelement a width of 0. On transition just increase the width to 50% and it will grow in that direction.
Adjust the left or right setting from 50% to 0, and increase the width to make it span the entire link.
* {
margin: 0px;
font-family: Futura;
font-weight: 100;
-webkit-font-smoothing: antialiased;
color: white;
}
body {
background-image: url("../Media/body-bg.png");
}
/* NOTE: Class */
.navigation-box {
height: 60px;
width: 100%;
background-color: MediumSeaGreen;
position: fixed;
z-index: 1;
min-width: 800px;
}
.navigation-menu {
margin: 6px 15px;
float: left;
color: white;
}
.navigation-link {
padding: 6px 10px;
font-weight: 100 !important;
font-size: 23px;
padding-bottom: 12px;
text-decoration: none;
transition: left 2s, all ease-in-out 300ms;
position: relative;
}
.navigation-link:after {
content: '';
position: absolute;
left: 50%;
width: 0;
bottom: 0;
height: 2px;
background: darkgreen;
transition: width 300ms ease-in-out;
}
.navigation-link:hover {
color: Wheat;
}
.navigation-link:hover:after {
width: 50%;
}
.vline {
border-left: 2px solid white;
padding-bottom: 6px;
margin: 0px 0px 0px 10px;
}
<!DOCTYPE html>
<html>
<head>
<title>Cabinet Psychologie | 15ème</title>
<link href="./Data/CSS/styling.css" rel="stylesheet" type="text/css">
</head>
<body noresize="noresize">
<div class="navigation-box">
<h1 class="navigation-menu">
Accueil
<a class="vline"></a>
Cours
<a class="vline"></a>
Plans
<a class="vline"></a>
Plus
</h1>
</div>
</body>
</html>
You can achieve this by using :after or :before pseudo elements and by adding transform and transition property to it.
.navigation-box{
height: 60px;
width: 100%;
background-color: MediumSeaGreen;
position: fixed;
z-index: 1;
min-width: 800px;
}
a.navigation-link{
position: relative;
color: #000;
text-decoration: none;
}
a.navigation-link:hover {
color: #000;
}
a.navigation-link:before {
content: "";
position: absolute;
width: 100%;
height: 2px;
bottom: 0;
left: 0;
background-color: #000;
visibility: hidden;
-webkit-transform: scaleX(0);
transform: scaleX(0);
-webkit-transition: all 0.3s ease-in-out 0s;
transition: all 0.3s ease-in-out 0s;
}
a.navigation-link:hover:before {
visibility: visible;
-webkit-transform: scaleX(1);
transform: scaleX(1);
}
<div class="navigation-box">
<h1 class="navigation-menu">
Accueil<a class="vline"></a>
Cours<a class="vline"></a>
Plans<a class="vline"></a>
Plus
</h1>
</div>
I found this modal http://codepen.io/imprakash/pen/GgNMXO pure html and css no js. It's all great and all but how can I make it trigger without using a button or link? I want it to pop up to welcome visitors once the website load.
<div id="popup1" class="overlay">
<div class="popup">
<h2>Here i am</h2>
<a class="close" href="#">×</a>
<div class="content">
Thank to pop me out of that button, but now i'm done so you can close this window.
</div>
</div>
i modified your codepen
body {
font-family: Arial, sans-serif;
background: url(http://www.shukatsu-note.com/wp-content/uploads/2014/12/computer-564136_1280.jpg) no-repeat;
background-size: cover;
height: 100vh;
}
h1 {
text-align: center;
font-family: Tahoma, Arial, sans-serif;
color: #06D85F;
margin: 80px 0;
}
.box {
width: 40%;
margin: 0 auto;
background: rgba(255,255,255,0.2);
padding: 35px;
border: 2px solid #fff;
border-radius: 20px/50px;
background-clip: padding-box;
text-align: center;
}
.button {
font-size: 1em;
padding: 10px;
color: #fff;
border: 2px solid #06D85F;
border-radius: 20px/50px;
text-decoration: none;
cursor: pointer;
transition: all 0.3s ease-out;
}
.button:hover {
background: #06D85F;
}
.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:not(:target) {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: #06D85F;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
#media screen and (max-width: 700px){
.box{
width: 70%;
}
.popup{
width: 70%;
}
}
<h1>Popup/Modal Windows without JavaScript</h1>
<div class="box">
<a class="button" href="#popup1">Let me Pop up</a>
</div>
<div id="popup1" class="overlay">
<div class="popup">
<h2>Here i am</h2>
<a class="close" href="#popup1">×</a>
<div class="content">
Thank to pop me out of that button, but now i'm done so you can close this window.
</div>
</div>
</div>
You could make it with animations. A quick example:
#popup1 {
animation-name: welcome;
animation-duration: 2s;
}
#keyframes welcome {
0% {
opacity: 0;
}
30% {
opacity: 0;
}
100% {
opacity: 1;
}
}
<div id="popup1" class="overlay">Hey!</div>
As the technique uses :target psuedo class, you can directly target with appending the id of that pop up element.
Try this, http://codepen.io/imprakash/pen/GgNMXO#popup1
Just appended #popup1 to target. Thus as soon as you open, popup will be targeted and opened.