I am new in web development.I'm making a website for a client for the first time.My fading in words "INNOATIVE.....EDUCATION" crashes into each other when I make my window smaller.I want them to be responsive, to stay in one line but get smaller in size.I would appreciate if anyone can help me.
https://jsfiddle.net/dL9m41se/
Ralevant CSS:
#-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
#-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
#keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.fade-in {
opacity:0; /* make things invisible upon start */
-webkit-animation:fadeIn ease-in 1; /* call our keyframe named fadeIn, use animattion ease-in and repeat it only 1 time */
-moz-animation:fadeIn ease-in 1;
animation:fadeIn ease-in 1;
-webkit-animation-fill-mode:forwards; /* this makes sure that after animation is done we remain at the last keyframe value (opacity: 1)*/
-moz-animation-fill-mode:forwards;
animation-fill-mode:forwards;
-webkit-animation-duration:1s;
-moz-animation-duration:1s;
animation-duration:1s;
}
.fade-in.one {
-webkit-animation-delay: 0.7s;
-moz-animation-delay: 0.7s;
animation-delay: 0.7s;
/*margin-left: auto;
margin-right: auto;*/
/*width: 10%;
height: 3%;*/
}
.fade-in.two {
-webkit-animation-delay: 1.2s;
-moz-animation-delay:1.2s;
animation-delay: 1.2s;
/*margin-left: auto;
margin-right: auto;*/
/* width: 10%;
height: 3%;*/
}
.fade-in.three {
-webkit-animation-delay: 1.6s;
-moz-animation-delay: 1.6s;
animation-delay: 1.6s;
/*margin-left: auto;
margin-right: auto;*/
/* width: 10%;
height: 3%;*/
}
.fade-in.four {
-webkit-animation-delay: 2s;
-moz-animation-delay: 2s;
animation-delay: 2s;
padding-left: 12%;
/* margin-left: auto;
margin-right: auto;*/
/* width: 10%;
height: 3%;
}*/
}
.fade-in.five {
-webkit-animation-delay: 2.4s;
-moz-animation-delay: 2.4s;
animation-delay: 2.4s;
/*margin-left: auto;
margin-right: auto;*/
/* width: 10%;
height: 3%;*/
}
.box{
padding-left:8%;
width: 16.7%;
height: 5%;
position: relative;
margin: .8%;
float: left;
overflow:inherit;
/*border: 1px solid #333;
background: #999;*/
}
An option would be to use viewport units vw for the font size
font-size: 2.5vw;
Sample snippet
#-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
#-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
#keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.fade-in {
opacity:0; /* make things invisible upon start */
-webkit-animation:fadeIn ease-in 1; /* call our keyframe named fadeIn, use animattion ease-in and repeat it only 1 time */
-moz-animation:fadeIn ease-in 1;
animation:fadeIn ease-in 1;
-webkit-animation-fill-mode:forwards; /* this makes sure that after animation is done we remain at the last keyframe value (opacity: 1)*/
-moz-animation-fill-mode:forwards;
animation-fill-mode:forwards;
-webkit-animation-duration:1s;
-moz-animation-duration:1s;
animation-duration:1s;
}
.fade-in.one {
-webkit-animation-delay: 0.7s;
-moz-animation-delay: 0.7s;
animation-delay: 0.7s;
/*margin-left: auto;
margin-right: auto;*/
/*width: 10%;
height: 3%;*/
}
.fade-in.two {
-webkit-animation-delay: 1.2s;
-moz-animation-delay:1.2s;
animation-delay: 1.2s;
/*margin-left: auto;
margin-right: auto;*/
/* width: 10%;
height: 3%;*/
}
.fade-in.three {
-webkit-animation-delay: 1.6s;
-moz-animation-delay: 1.6s;
animation-delay: 1.6s;
/*margin-left: auto;
margin-right: auto;*/
/* width: 10%;
height: 3%;*/
}
.fade-in.four {
-webkit-animation-delay: 2s;
-moz-animation-delay: 2s;
animation-delay: 2s;
padding-left: 12%;
/* margin-left: auto;
margin-right: auto;*/
/* width: 10%;
height: 3%;
}*/
}
.fade-in.five {
-webkit-animation-delay: 2.4s;
-moz-animation-delay: 2.4s;
animation-delay: 2.4s;
/*margin-left: auto;
margin-right: auto;*/
/* width: 10%;
height: 3%;*/
}
.box{
padding-left:8%;
width: 16.7%;
height: 5%;
font-size: 2.5vw;
position: relative;
margin: .8%;
float: left;
overflow:inherit;
/*border: 1px solid #333;
background: #999;*/
}
<div id="home-slider" class="carousel slide carousel-fade" data-ride="carousel">
<div class="carousel-inner">
<div class="item active" style="background-image: url(images/slider/1.jpg">
<div class="caption">
<div class="center-div-words" >
<h1> <span style="color: #000;font-family: 'Special Elite', cursive; ">CENTER FOR MEMBRANE STUDY</span></h1>
<p style="font-size: 100%;font-family: 'Special Elite', cursive;"><span class="box fade-in one" id="1">INNOATIVE</span><span class="box fade-in two" id="2">COLLABORATIVE</span><span></span><span class="box fade-in three" id="3"> INTERDISCIPLINARY</span><span class="box fade-in four" id="4">RESEARCH</span>
<span class="box fade-in five" id="5">EDUCATION</span>
</p>
</div><!-- center-div-words -->
</div> <!-- caption -->
</div> <!-- image -->
</div><!--/#home-slider-->
Add this to your css, now the words won't cross.
Responsive wise it's better that you place them under each other.
Keeping them inline isn't the best practice responsive wise.
Adjust the max-width as you please of course.
#media screen and (max-width: 600px){
.box{
width:100%;
}
}
If you do want to keep them inline, let me know and I'll do some more tweaking!
One way you can go about this is adding in media queries to set max-widths so that it can only go so small.
#media only screen and (max-width: 480px) {
/* This CSS will be applied only to phones and other small devices. */
font-size: 20px; width: 100%; }
//Lots more can be done in there
You could also play around with flexBox to help.
<script type="text/javascript">
$('#mainNavbar').flexMenu();</script>
And checkout this page here. It has a small tutorial on responsive navbar design/creation.
You can reduce font-size after certain width with a #media query (adjust values to your benefit, demo is set to 16px):
#media (max-width: 768px) {
p span {
font-size: 16px;
}
}
#-webkit-keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
#-moz-keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
#keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.fade-in {
opacity: 0;
/* make things invisible upon start */
-webkit-animation: fadeIn ease-in 1;
/* call our keyframe named fadeIn, use animattion ease-in and repeat it only 1 time */
-moz-animation: fadeIn ease-in 1;
animation: fadeIn ease-in 1;
-webkit-animation-fill-mode: forwards;
/* this makes sure that after animation is done we remain at the last keyframe value (opacity: 1)*/
-moz-animation-fill-mode: forwards;
animation-fill-mode: forwards;
-webkit-animation-duration: 1s;
-moz-animation-duration: 1s;
animation-duration: 1s;
}
.fade-in.one {
-webkit-animation-delay: 0.7s;
-moz-animation-delay: 0.7s;
animation-delay: 0.7s;
/*margin-left: auto;
margin-right: auto;*/
/*width: 10%;
height: 3%;*/
}
.fade-in.two {
-webkit-animation-delay: 1.2s;
-moz-animation-delay: 1.2s;
animation-delay: 1.2s;
/*margin-left: auto;
margin-right: auto;*/
/* width: 10%;
height: 3%;*/
}
.fade-in.three {
-webkit-animation-delay: 1.6s;
-moz-animation-delay: 1.6s;
animation-delay: 1.6s;
/*margin-left: auto;
margin-right: auto;*/
/* width: 10%;
height: 3%;*/
}
.fade-in.four {
-webkit-animation-delay: 2s;
-moz-animation-delay: 2s;
animation-delay: 2s;
padding-left: 12%;
/* margin-left: auto;
margin-right: auto;*/
/* width: 10%;
height: 3%;
}*/
}
.fade-in.five {
-webkit-animation-delay: 2.4s;
-moz-animation-delay: 2.4s;
animation-delay: 2.4s;
/*margin-left: auto;
margin-right: auto;*/
/* width: 10%;
height: 3%;*/
}
.box {
padding-left: 8%;
width: 16.7%;
height: 5%;
position: relative;
margin: .8%;
float: left;
overflow: inherit;
/*border: 1px solid #333;
background: #999;*/
}
#media (max-width: 768px) {
p span {
font-size: 16px;
}
}
<div id="home-slider" class="carousel slide carousel-fade" data-ride="carousel">
<div class="carousel-inner">
<div class="item active" style="background-image: url(images/slider/1.jpg">
<div class="caption">
<div class="center-div-words">
<h1> <span style="color: #000;font-family: 'Special Elite', cursive; ">CENTER FOR MEMBRANE STUDY</span></h1>
<p style="font-size: 100%;font-family: 'Special Elite', cursive;"><span class="box fade-in one" id="1">INNOATIVE</span><span class="box fade-in two" id="2">COLLABORATIVE</span><span class="box fade-in three" id="3"> INTERDISCIPLINARY</span><span class="box fade-in four" id="4">RESEARCH</span>
<span class="box fade-in five" id="5">EDUCATION</span>
</p>
</div>
<!-- center-div-words -->
</div>
<!-- caption -->
</div>
<!-- image -->
</div>
<!--/#home-slider-->
Related
Is there a way to write the CSS code without using all the nth-child() selectors? I want to make the code more scalable in case I want to add more snowflakes in the future.
body {
background-color: red;
}
.snowflake {
color: #fff;
font-size: 1em;
font-family: Arial;
text-shadow: 0 0 1px #000;
}
#-webkit-keyframes snowflakes-fall {
0% {
top: -10%;
}
100% {
top: 100%;
}
}
#-webkit-keyframes snowflakes-shake {
0% {
-webkit-transform: translateX(0px);
transform: translateX(0px);
}
50% {
-webkit-transform: translateX(80px);
transform: translateX(80px);
}
100% {
-webkit-transform: translateX(0px);
transform: translateX(0px);
}
}
#keyframes snowflakes-fall {
0% {
top: -10%;
}
100% {
top: 100%;
}
}
#keyframes snowflakes-shake {
0% {
transform: translateX(0px);
}
50% {
transform: translateX(80px);
}
100% {
transform: translateX(0px);
}
}
.snowflake {
position: fixed;
top: -10%;
z-index: 9999;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: default;
-webkit-animation-name: snowflakes-fall, snowflakes-shake;
-webkit-animation-duration: 10s, 3s;
-webkit-animation-timing-function: linear, ease-in-out;
-webkit-animation-iteration-count: infinite, infinite;
-webkit-animation-play-state: running, running;
animation-name: snowflakes-fall, snowflakes-shake;
animation-duration: 10s, 3s;
animation-timing-function: linear, ease-in-out;
animation-iteration-count: infinite, infinite;
animation-play-state: running, running;
}
.snowflake:nth-of-type(0) {
left: 1%;
-webkit-animation-delay: 0s, 0s;
animation-delay: 0s, 0s;
}
.snowflake:nth-of-type(1) {
left: 10%;
-webkit-animation-delay: 1s, 1s;
animation-delay: 1s, 1s;
}
.snowflake:nth-of-type(2) {
left: 20%;
-webkit-animation-delay: 6s, 0.5s;
animation-delay: 6s, 0.5s;
}
.snowflake:nth-of-type(3) {
left: 30%;
-webkit-animation-delay: 4s, 2s;
animation-delay: 4s, 2s;
}
.snowflake:nth-of-type(4) {
left: 40%;
-webkit-animation-delay: 2s, 2s;
animation-delay: 2s, 2s;
}
.snowflake:nth-of-type(5) {
left: 50%;
-webkit-animation-delay: 8s, 3s;
animation-delay: 8s, 3s;
}
.snowflake:nth-of-type(6) {
left: 60%;
-webkit-animation-delay: 6s, 2s;
animation-delay: 6s, 2s;
}
.snowflake:nth-of-type(7) {
left: 70%;
-webkit-animation-delay: 2.5s, 1s;
animation-delay: 2.5s, 1s;
}
.snowflake:nth-of-type(8) {
left: 80%;
-webkit-animation-delay: 1s, 0s;
animation-delay: 1s, 0s;
}
.snowflake:nth-of-type(9) {
left: 90%;
-webkit-animation-delay: 3s, 1.5s;
animation-delay: 3s, 1.5s;
}
/* Demo Purpose Only*/
.demo {
font-family: 'Raleway', sans-serif;
color: #fff;
display: block;
margin: 0 auto;
padding: 15px 0;
text-align: center;
}
.demo a {
font-family: 'Raleway', sans-serif;
color: #000;
}
<div class="snowflakes" aria-hidden="true">
<div class="snowflake">❅</div>
<div class="snowflake">❅</div>
<div class="snowflake">❆</div>
<div class="snowflake">❄</div>
<div class="snowflake">❅</div>
<div class="snowflake">❆</div>
<div class="snowflake">❄</div>
<div class="snowflake">❅</div>
<div class="snowflake">❆</div>
<div class="snowflake">❄</div>
</div>
Start by removing all the non needed prefixes and the default values. Then in such situation you can use inline styles combined with CSS variables to add the specific CSS. I have also updated the code a little to use flexbox and get rid of all the left values:
.snowflakes {
display: flex;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #000;
z-index: 9999;
pointer-events:none;
}
.snowflake {
color: #fff;
font-size: 1em;
font-family: Arial;
text-shadow: 0 0 1px #000;
flex: 1;
position: relative;
top: -10%;
animation: snowflakes-fall 10s linear, snowflakes-shake 3s ease-in-out;
animation-delay: var(--d);
animation-iteration-count: infinite;
}
#keyframes snowflakes-fall {
100% {
top: 100%;
}
}
#keyframes snowflakes-shake {
50% {
transform: translateX(80px);
}
}
<div class="snowflakes" aria-hidden="true">
<div class="snowflake" style="--d: 0s, 0s;">❅</div>
<div class="snowflake" style="--d: 1s, 1s;">❅</div>
<div class="snowflake" style="--d: 6s, 0.5s;">❆</div>
<div class="snowflake" style="--d: 4s, 2s;">❄</div>
<div class="snowflake" style="--d: 2s, 2s;">❅</div>
<div class="snowflake" style="--d: 8s, 3s;">❆</div>
<div class="snowflake" style="--d: 6s, 2s;">❄</div>
<div class="snowflake" style="--d: 2.5s, 1s;">❅</div>
<div class="snowflake" style="--d: 1s, 0s;">❆</div>
<div class="snowflake" style="--d: 3s, 1.5s;">❄</div>
</div>
So I want to have an image that covers the entire screen until you start scrolling down. (This image is also a slideshow with fading animation) At the center of that image should be text. A header should overlap the image and a footer should be beneath it. (I will add more content inbetween the footer and the image later)
However, currently it is not working as intended. Both the header and the footer are overlapped by the background image. The text centers right where the header and footer snap together instead of in the middle of the background image. I need some help with this. Refer to an image and code below. You may also view the page at https://www.mh-rp.com.
image with notes and clarification
<body style="background-color:#111111">
<header>
<div class="header">
<div class="inner_header">
<div class="logo_container">
<img src="/images/weblogo.png" alt="MHRP">
</div>
<ul class="navigation">
<li><i class="fa fa-home"></i> Home</li>
<li><i class="fa fa-address-card"></i> About</li>
<li><i class="fa fa-comments"></i> Forum</li>
<li><i class="fa fa-sign-in"></i> UCP</li>
<li><i class="fab fa-discord"></i> Discord</li>
</ul>
<div class="menu-toggle"><i class="fa fa-bars" aria-hidden="true"></i></div>
</div>
</div>
</header>
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.menu-toggle').click(function(){
$('.navigation').toggleClass('active')
})
})
</script>
<main>
<div class="image_container">
<div id="background-preload" class="background-start"></div>
<script>$('#background-preload').delay(5000).fadeOut('slow');</script>
<ul class="cb-slideshow">
<li><span></span></li>
<li><span></span></li>
<li><span></span></li>
<li><span></span></li>
<li><span></span></li>
<li><span></span></li>
</ul>
<div class="maintext">Mulholland Roleplay
<div><img class="ipimage" src="/images/sa-mp.png"></div>
<div><span class="mainip">57.80.79.165:1050</span></div>
<div><a class="mainbutton" href="https://www.forum.mh-rp.com/wiki/game-server/">Play Now</a></div>
</div>
</div>
</main>
<footer>
<div class="footer">
<div class="inner_footer">
<div class="logo_container2">
<img src="/images/logo.png" alt="MHRP">
<div>
<img src ="https://images.dmca.com/Badges/dmca_protected_sml_120l.png?ID=6c4220d8-268c-4e0c-897f-3ba9a38e002d" alt="DMCA.com Protection Status" /> <script src="https://images.dmca.com/Badges/DMCABadgeHelper.min.js"> </script>
</div>
</div>
<div class="footer_third">
<h1>Need Help?</h1>
Contact Us
Cookie Usage
Terms & Conditions
Privacy Policy
</div>
<div class="footer_third">
<h1>More</h1>
Encyclopedia
Credit Store
Rockstar Games
San Andreas Multiplayer
</div>
<div class="footer_third">
<h1>Follow Us</h1>
<li><i class="fa fa-instagram"></i> Instagram</li>
<li><i class="fa fa-twitter"></i> Twitter</li>
<li><i class="fa fa-youtube"></i> YouTube</li>
</div>
<br/>
<div class="footer_third">
<p style="color:white; text-align:center; font-size:16px;"><br/><br/>Copyright © 2019 mh-rp.com
<br/>
The mh-rp game server is powered by sa-mp.com. sa-mp.com is powered by Grand Theft Auto: San Andreas.
<br/>
mh-rp.com and the contents herein, are not affiliated with Rockstar Games, Rockstar North, Take-Two Interactive Software Inc or sa-mp.com.
<br/>
Grand Theft Auto and Grand Theft Auto: San Andreas are registered trademarks of Take-Two Interactive Software Inc.</p>
</div>
</div>
</footer>
<script src="/js/cookieconsent.min.js" data-cfasync="false"></script>
<script>
window.cookieconsent.initialise({
"palette": {
"popup": {
"background": "#3a3a3a",
"text": "#a0a09e"
},
"button": {
"background": "#185886"
}
},
"content": {
"message": "This site uses cookies to help personalise content, tailor your experience, advertise and to keep you logged in if you register.\nBy continuing to use this site, you are consenting to our use of cookies.",
"dismiss": "Accept",
"link": "Learn more..."
},
"position": "bottom-left"
});
</script>
</body>
#import url('https://fonts.googleapis.com/css?family=Staatliches&display=swap');
*
{
margin: 0;
padding: 0;
list-style: none;
text-decoration: none;
}
/* start of not found */
.logo_container3
{
text-align: center;
}
.headertext
{
color: white;
display: block;
text-align: center;
width: 100%;
padding-top: 20px;
}
.buttontext
{
color: white;
font-family: "Verdana";
padding: 0px 20px;
}
.buttontext:hover
{
color:white; background:#292929;
-o-transition:color .2s ease-out, background 0.5s ease-in;
-ms-transition:color .2s ease-out, background 0.5s ease-in;
-moz-transition:color .2s ease-out, background 0.5s ease-in;
-webkit-transition:color .2s ease-out, background 0.5s ease-in;
/* ...and now override with proper CSS property */
transition:color .2s ease-out, background 0.5s ease-in;
background-color: #185886;
}
/* end of not found */
/* start of header */
.header
{
width: 100%;
height: 80px;
display: block;
background-color: #292929;
}
.inner_header
{
width: 1000px;
height: 100%;
display: block;
margin: 0 auto;
background-color: #292929;
}
.logo_container
{
height: 100%;
display: table;
float: left;
}
.logo_container img
{
display: table-cell;
vertical-align: middle;
padding-top: 5%;
height:60px
}
.navigation
{
float: right;
height: 100%;
}
.navigation a
{
height: 100%;
display: table;
float: left;
padding: 0px 20px;
}
.navigation a li
{
display: table-cell;
vertical-align: middle;
height: 100%;
color: white;
font-family: "Verdana";
font-size: 16px;
}
.navigation a:first-child
{
background-color: #185886;
}
.navigation a:hover
{
color:white; background:#292929;
-o-transition:color .2s ease-out, background 0.5s ease-in;
-ms-transition:color .2s ease-out, background 0.5s ease-in;
-moz-transition:color .2s ease-out, background 0.5s ease-in;
-webkit-transition:color .2s ease-out, background 0.5s ease-in;
/* ...and now override with proper CSS property */
transition:color .2s ease-out, background 0.5s ease-in;
background-color: #185886;
}
/* mobile */
.menu-toggle
{
color: white;
float:right;
line-height: 77px;
font-size: 48px;
cursor: pointer;
display: none;
}
#media (max-width: 1000px)
{
.menu-toggle
{
display: block;
}
.navigation
{
position: absolute;
width: 100%;
height: calc(100vh -50px);
background: #333;
top: 80px;
left: -100%;
transition: 0.5s;
display: grid;
}
.navigation.active
{
left: 0;
}
.navigation ul
{
display: block;
text-align: center;
}
.navigation ul li a
{
border-bottom: 1px solid rgba(0,0,0,.2);
}
.inner_header
{
width: 90%;
}
}
/* end of header */
/* start of footer */
.footer
{
width: 100vw;
display: block;
overflow: hidden;
padding: 70px 0;
box-sizing: border-box;
background-color: #18181a;
}
.inner_footer
{
display: block;
margin: 0 auto;
width: 1100px;
height: 100%;
}
.inner_footer .logo_container2
{
width:35%;
float: left;
height: 100%;
display: block;
}
.inner_footer .logo_container2 img
{
width: 100px;
height: auto;
}
.inner_footer .footer_third
{
width: calc(21.6666666667% -20px);
margin-right: 10px;
float: left;
height: 100%;
}
.inner_footer .footer_third:last-child
{
margin-right: 0;
}
.inner_footer .footer_third h1
{
font-family: 'arial';
font-size: 22px;
color: white;
display: block;
width: 100%;
margin-bottom: 20px;
}
.inner_footer .footer_third a
{
font-family: "Arial";
font-size: 18px;
color: white;
display: block;
font-weight: 200;
width: 100%;
}
.inner_footer .footer_third a:hover
{
color:white; background:#292929;
-o-transition:color .2s ease-out, background 0.5s ease-in;
-ms-transition:color .2s ease-out, background 0.5s ease-in;
-moz-transition:color .2s ease-out, background 0.5s ease-in;
-webkit-transition:color .2s ease-out, background 0.5s ease-in;
/* ...and now override with proper CSS property */
transition:color .2s ease-out, background 0.5s ease-in;
background-color: #185886;
}
/* mobile */
#media(max-width: 1000px)
{
.footer .inner_footer
{
width: 90%;
}
.inner_footer .logo_Container2,
.inner_footer .footer_third
{
width: 100%;
margin-bottom: 30px;
}
}
/* end of footer */
/* start of main */
body
{
overflow-x: hidden;
}
/* this is there to show no fading animation when you load the page for the first time */
.background-start
{
background-image: url(../images/1.png);
position: fixed;
background-attachment: fixed;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
background-size: cover;
background-position: 50% 50%;
background-repeat: none;
}
.cb-slideshow,
.cb-slideshow:after {
position: fixed;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
z-index: 0;
}
.cb-slideshow li span {
width: 100%;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
color: transparent;
background-size: cover;
background-position: 50% 50%;
background-repeat: none;
background-attachment: fixed;
opacity: 0;
z-index: 0;
-webkit-backface-visibility: hidden;
-webkit-animation: imageAnimation 36s linear infinite 0s;
-moz-animation: imageAnimation 36s linear infinite 0s;
-o-animation: imageAnimation 36s linear infinite 0s;
-ms-animation: imageAnimation 36s linear infinite 0s;
animation: imageAnimation 36s linear infinite 0s;
}
.cb-slideshow li:nth-child(1) span {
background-image: url(../images/1.png);
}
.cb-slideshow li:nth-child(2) span {
background-image: url(../images/2.png);
-webkit-animation-delay: 6s;
-moz-animation-delay: 6s;
-o-animation-delay: 6s;
-ms-animation-delay: 6s;
animation-delay: 6s;
}
.cb-slideshow li:nth-child(3) span {
background-image: url(../images/3.png);
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
-o-animation-delay: 12s;
-ms-animation-delay: 12s;
animation-delay: 12s;
}
.cb-slideshow li:nth-child(4) span {
background-image: url(../images/4.png);
-webkit-animation-delay: 18s;
-moz-animation-delay: 18s;
-o-animation-delay: 18s;
-ms-animation-delay: 18s;
animation-delay: 18s;
}
.cb-slideshow li:nth-child(5) span {
background-image: url(../images/5.png);
-webkit-animation-delay: 24s;
-moz-animation-delay: 24s;
-o-animation-delay: 24s;
-ms-animation-delay: 24s;
animation-delay: 24s;
}
.cb-slideshow li:nth-child(6) span {
background-image: url(../images/6.png);
-webkit-animation-delay: 30s;
-moz-animation-delay: 30s;
-o-animation-delay: 30s;
-ms-animation-delay: 30s;
animation-delay: 30s;
}
/* Animation for the slideshow images */
#-webkit-keyframes imageAnimation {
0% { opacity: 0;
-webkit-animation-timing-function: ease-in; }
8% { opacity: 1;
-webkit-animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
#-moz-keyframes imageAnimation {
0% { opacity: 0;
-moz-animation-timing-function: ease-in; }
8% { opacity: 1;
-moz-animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
#-o-keyframes imageAnimation {
0% { opacity: 0;
-o-animation-timing-function: ease-in; }
8% { opacity: 1;
-o-animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
#-ms-keyframes imageAnimation {
0% { opacity: 0;
-ms-animation-timing-function: ease-in; }
8% { opacity: 1;
-ms-animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
#keyframes imageAnimation {
0% { opacity: 0;
animation-timing-function: ease-in; }
8% { opacity: 1;
animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
/* Show at least something when animations not supported */
.no-cssanimations .cb-slideshow li span{
opacity: 1;
}
#media screen and (max-width: 1140px) {
.cb-slideshow li div h3 { font-size: 140px }
}
#media screen and (max-width: 600px) {
.cb-slideshow li div h3 { font-size: 80px }
}
.image_container
{
position:relative;
}
.maintext
{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
font-family: "Staatliches", "Arial", sans-serif;
font-weight:normal;
font-style:normal;
font-size: 72px;
}
.mainbutton
{
position: absolute;
top: 150%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
font-family: "Staatliches", "Arial", sans-serif;
font-weight:normal;
font-style:normal;
font-size: 32px;
border-style: solid;
border-width: 1px;
border-color: white;
transition: border-width 0.3s;
padding: 5px 5px 5px 5px;
}
.mainip
{
position: absolute;
top: 100%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
font-family: "Staatliches", "Arial", sans-serif;
font-weight:normal;
font-style:normal;
font-size: 32px;
}
.ipimage
{
position: absolute;
top: 80%;
left: 27.5%;
width: 32px;
}
.mainbutton:hover
{
border-width: 3px;
}
/* end of main */
Add those two selectors.
.image-container { height: 100vh }
header, footer { position: relative; z-index: 1 }
I am struggling to get the word "Breaking" to be centered in the Box it is in. I am also struggling getting the scrolling to be continuous, right now there is too much of a delay. I would also like the "Breaking", and the "TEST" headline to stand out, and be more bold. Right now the coding is done, and it works. Just a few minor tweaks. Also is it possible to make whatever I type into "breaking"and test" be a link as well?
.breaking-news-headline {
display: block;
position: absolute;
font-family: arial;
font-size: 15px;
margin-top: -22px;
color: white;
margin-left: 150px;
}
.breaking-news-title {
background-color: #FFFF00;
display: block;
height: 20px;
width: 120px;
font-family: arial;
font-size: 15px;
position: absolute;
top: 0px;
margin-top: auto;
margin-left: auto;
padding-top: 10px;
padding-left: 10px;
z-index: 3;
&:before {
content: "";
position: absolute;
display: block;
width: 0px;
height: 0px;
top: 10;
left: -12px;
border-left: 12px solid transparent;
border-right: 0px solid transparent;
border-bottom: 30px solid #FFEA00;
}
&:after {
content: "";
position: absolute;
display: block;
width: 10px;
height: 0px;
right: -12px;
top: 0;
border-right: 12px solid transparent;
border-left: 0px solid transparent;
border-top: 30px solid #FFEA00;
}
}
#breaking-news-colour {
height: 30px;
width: 2394px;
background-color: #FF0000;
}
#breaking-news-container {
height: 30px;
width: 800px;
overflow: hidden;
position: absolute;
&:before {
content: "";
width: 30px;
height: 30px;
background-color: #3399FF;
position: absolute;
z-index: 2;
}
}
.animated {
-webkit-animation-duration: 0.2s;
-webkit-animation-fill-mode: both;
-moz-animation-duration: 0.2s;
-moz-animation-fill-mode: both;
-webkit-animation-iteration-count: 1;
-moz-animation-iteration-count: 1;
}
.delay-animated {
-webkit-animation-duration: 0.4s;
-webkit-animation-fill-mode: both;
-moz-animation-duration: 0.4s;
-moz-animation-fill-mode: both;
-webkit-animation-iteration-count: 1;
-moz-animation-iteration-count: 1;
-webkit-animation-delay: 0.3s;
animation-delay: 0.3s;
}
.scroll-animated {
-webkit-animation-duration: 3s;
-webkit-animation-fill-mode: both;
-moz-animation-duration: 3s;
-moz-animation-fill-mode: both;
-webkit-animation-iteration-count: 1;
-moz-animation-iteration-count: 1;
-webkit-animation-delay: 0.5s;
animation-delay: 0.5s;
}
.delay-animated2 {
-webkit-animation-duration: 0.4s;
-webkit-animation-fill-mode: both;
-moz-animation-duration: 0.4s;
-moz-animation-fill-mode: both;
-webkit-animation-iteration-count: 1;
-moz-animation-iteration-count: 1;
-webkit-animation-delay: 0.5s;
animation-delay: 0.5s;
}
.delay-animated3 {
-webkit-animation-duration: 5s;
-webkit-animation-fill-mode: both;
-moz-animation-duration: 5s;
-moz-animation-fill-mode: both;
-webkit-animation-iteration-count: 1;
-moz-animation-iteration-count: 1;
-webkit-animation-delay: 0.5s;
animation-delay: 3s;
}
.fadein {
-webkit-animation-name: fadein;
-moz-animation-name: fadein;
-o-animation-name: fadein;
animation-name: fadein;
}
#-webkit-keyframes fadein {
from {
margin-left: 1000px
}
to {}
}
#-moz-keyframes fadein {
from {
margin-left: 1000px
}
to {}
}
.slidein {
-webkit-animation-name: slidein;
-moz-animation-name: slidein;
-o-animation-name: slidein;
animation-name: slidein;
}
#keyframes marquee {
0% {
left: 0;
}
20% {
left: 0;
}
100% {
left: -100%;
}
}
.marquee {
animation: marquee 3s linear infinite;
-webkit-animation-duration: 10s;
-moz-animation-duration: 10a;
-webkit-animation-delay: 0.5s;
animation-delay: 3s;
}
#-webkit-keyframes slidein {
from {
margin-left: 800px
}
to {
margin-top: 0px
}
}
#-moz-keyframes slidein {
from {
margin-left: 800px
}
to {
margin-top: 0px
}
}
.slideup {
-webkit-animation-name: slideup;
-moz-animation-name: slideup;
-o-animation-name: slideup;
animation-name: slideup;
}
#-webkit-keyframes slideup {
from {
margin-top: 30px
}
to {
margin-top: 0;
}
}
#-moz-keyframes slideup {
from {
margin-top: 30px
}
to {
margin-top: 0;
}
}
<div id="breaking-news-container">
<div id="breaking-news-colour" class="slideup animated">
</div>
<span class="breaking-news-title delay-animated slidein">
BREAKING
</span>
<a class="breaking-news-headline delay-animated2 fadein marquee">
TEST
</a>
</div>
I am struggling to get the word "Breaking" to be centered in the Box it is in
.breaking-news-title {
text-align: center;
font-weight: bold;
padding-top: 7px;
height: 30px;
}
delete → padding-left: 0px;
I would also like the "Breaking", and the "TEST" headline to stand
out, and be more bold.
just add font-weight: bold;
Also is it possible to make whatever I type into "breaking"and test"
be a link as well? Thanks!
yes, replace your span to <a> tag and your "TEST" is already <a> tag
and by the way according to caniuse.com <marquee> tag is deprecated so you should not use it
http://caniuse.com/#search=marquee
but here is the edit I made
https://jsfiddle.net/gs8p0zc3/
use this css3 animation instead of marquee
EDIT made similar design of your code
https://jsfiddle.net/sfjjvpk5/1/
How to put my text moving from beginig to the end of the div constantly. I did something like this http://jsfiddle.net/swh2jqrg/ on my web page, but my message is going out in new line. I want that my text goes in a loop(circle). how to do that? my css looks like this:
.message1{
width: 1240px;
height: 94px;
font-size: 70px;
text-align:center;
color: white;
animation-duration: 10s;
animation-name: slidein;
animation-iteration-count: infinite;
animation-delay: forwards;
animation-direction: normal;
}
#keyframes slidein {
from {
margin-left: 0%;
width: 300%;
height:94px;
}
to {
margin-left: 100%;
width: 1240px;
height:94px;
}
}
Why this isn't working in Crome? sorry for the english and thanks for the answer.
You need to add vendor prefixes for chrome, -webkit-:
.content1{
width: 1280px;
height: 322px;
}
.message{
width: 1240px;
height: 94px;
background-color:#5292a5;
margin: 25px 20px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.message1{
width: 1240px;
height: 94px;
font-size: 70px;
text-align:center;
color: white;
-webkit-animation-duration: 10s;
-webkit-animation-name: slidein;
-webkit-animation-iteration-count: infinite;
-webkit-animation-delay: forwards;
-webkit-animation-direction: normal;
animation-duration: 10s;
animation-name: slidein;
animation-iteration-count: infinite;
animation-delay: forwards;
animation-direction: normal;
}
#-webkit-keyframes slidein {
from {
margin-left: 0%;
width: 300%;
height:94px;
}
to {
margin-left: 100%;
width: 1240px;
height:94px;
}
}
#keyframes slidein {
from {
margin-left: 0%;
width: 300%;
height:94px;
}
to {
margin-left: 100%;
width: 1240px;
height:94px;
}
}
Demo in a fiddle: http://jsfiddle.net/swh2jqrg/1/
Also, in order for the animation to work in mozilla and opera you'll need to add the -moz- and -o- prefixes as well.
ie:
.content1{
width: 1280px;
height: 322px;
}
.message{
width: 1240px;
height: 94px;
background-color:#5292a5;
margin: 25px 20px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.message1{
width: 1240px;
height: 94px;
font-size: 70px;
text-align:center;
color: white;
-webkit-animation-duration: 10s;
-webkit-animation-name: slidein;
-webkit-animation-iteration-count: infinite;
-webkit-animation-delay: forwards;
-webkit-animation-direction: normal;
-moz-animation-duration: 10s;
-moz-animation-name: slidein;
-moz-animation-iteration-count: infinite;
-moz-animation-delay: forwards;
-moz-animation-direction: normal;
-o-animation-duration: 10s;
-o-animation-name: slidein;
-o-animation-iteration-count: infinite;
-o-animation-delay: forwards;
-o-animation-direction: normal;
animation-duration: 10s;
animation-name: slidein;
animation-iteration-count: infinite;
animation-delay: forwards;
animation-direction: normal;
}
#-webkit-keyframes slidein {
from {
margin-left: 0%;
width: 300%;
height:94px;
}
to {
margin-left: 100%;
width: 1240px;
height:94px;
}
}
#-moz-keyframes slidein {
from {
margin-left: 0%;
width: 300%;
height:94px;
}
to {
margin-left: 100%;
width: 1240px;
height:94px;
}
}
#-o-keyframes slidein {
from {
margin-left: 0%;
width: 300%;
height:94px;
}
to {
margin-left: 100%;
width: 1240px;
height:94px;
}
}
#keyframes slidein {
from {
margin-left: 0%;
width: 300%;
height:94px;
}
to {
margin-left: 100%;
width: 1240px;
height:94px;
}
}
Demo in a fiddle: http://jsfiddle.net/swh2jqrg/3/
Or you can use another method with text-indent and text-shadow to have no wholes in between each loops :DEMO
.message{
width: 1240px;
background-color:#5292a5;
margin: 25px 20px;
border-radius: 5px;
overflow:hidden;
text-shadow:0 0 2px red, 1240px 0 , 1240px 0 2px blue;/* pick here another color for text mirrored */
animation:slidein infinite 10s linear;
font-size:60px;
color:turquoise;
line-height:94px;
}
.message1 {
display:inline-block;
width:100%;
text-indent:0;
}
#keyframes slidein {
from {
text-indent:-100%;
}
to {
text-indent:0%;
}
}
You need to add vendor prefix -webkit- for Chrome/Opera/Safari. Check CanIuse?
CSS
.message1{
width: 1240px;
height: 94px;
font-size: 70px;
text-align:center;
color: white;
-webkit-animation-duration: 10s;
-webkit-animation-name: slidein;
-webkit-animation-iteration-count: infinite;
-webkit-animation-delay: forwards;
-webkit-animation-direction: normal;
animation-duration: 10s;
animation-name: slidein;
animation-iteration-count: infinite;
animation-delay: forwards;
animation-direction: normal;
}
#-webkit-keyframes slidein {
from {
margin-left: 0%;
width: 300%;
height:94px;
}
to {
margin-left: 100%;
width: 1240px;
height:94px;
}
}
JSFiddle DEMO
I have this HTML:
<div id="container">
<div id="content">
<h2 class="frame1">Loriam Ipisum</h2>
<h2 class="frame2">Loriam Ipisumsad</h2>
</div>
</div>
And this CSS:
body{margin: 0; padding: 0;}
#container{
width: 100%;
top: 200px;
border: 1px solid black;
text-align: center;
position: relative;
overflow: hidden;
}
#content{
width: 300px;
height: 50px;
border: 1px solid blue;
position: relative;
margin-left: auto;
margin-right: auto;
overflow: hidden;
}
#content h2{
position: relative;
display: inline-block;
}
#content h2.frame1{
-webkit-animation-delay: 0s;
-webkit-animation-name: efeito1;
-webkit-animation-duration: 4s;
-webkit-animation-timing-function: linear;
-webkit-animation-direction: alternate;
}
#content h2.frame2{
-webkit-animation-delay: 3s;
-webkit-animation-name: efeito1;
-webkit-animation-duration: 4s;
-webkit-animation-timing-function: linear;
-webkit-animation-direction: alternate;
}
#-webkit-keyframes efeito1{
0%{
left: 0;
opacity: 0;
}
50%{
opacity: 0.4;
left: 100px;
opacity: 0.4;
left: 200;
}
100%{
opacity: 0;
left: 300px;
opacity: 0.4;
}
}
What I want to do is: I want both .frames be at the same LINE. SO when I apply the animation, it will happen at the same place, giving a nice effect. I want them to be at the same line, at the same place but without one text be upon the other looking like a mess...
I tried to use the overflow: Hidden: but didn't work, the texts stays one above the other...
I want to apply, this effect: http://codepen.io/anon/pen/LcwKj/
Any suggestion? Thanks !
Is this effect what you are aiming for:
HTML
<div id="container">
<div id="content">
<h2 class="frame1">Loriam Ipisum</h2>
<h2 class="frame2">sad</h2>
</div>
</div>
CSS
body{margin: 0; padding: 0;}
#container{
width: 100%;
top: 200px;
border: 1px solid black;
text-align: center;
position: relative;
overflow: hidden;
}
#content{
width: 100%;
height: 50px;
border: 1px solid blue;
position: relative;
margin-left: auto;
margin-right: auto;
overflow: hidden;
}
#content h2{
position: absolute;
display: inline-block;
}
#content h2.frame1{
-webkit-animation-delay: 0s;
-webkit-animation-name: efeito1;
-webkit-animation-duration: 4s;
-webkit-animation-timing-function: linear;
-webkit-animation-direction: alternate;
opacity:0;
}
#content h2.frame2{
-webkit-animation-delay: 3s;
-webkit-animation-name: efeito1;
-webkit-animation-duration: 3s;
-webkit-animation-timing-function: linear;
-webkit-animation-direction: alternate;
opacity:0;
position:absolute;
}
#-webkit-keyframes efeito1{
0%{
opacity: 0;
}
100%{
opacity: 100;
}
}