Visual Studio is not recognizing at-rules

Currently implementing code found at this URL:

This code includes:

@-webkit-keyframes moveclouds {
0% {margin-left: 1000px;}
100% {margin-left: -1000px;}
}
@-moz-keyframes moveclouds {
0% {margin-left: 1000px;}
100% {margin-left: -1000px;}
}
@-o-keyframes moveclouds {
0% {margin-left: 1000px;}
100% {margin-left: -1000px;}
}

Unfortunately, an error is being triggered:

https://i.sstatic.net/X2O7o.png


"Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: "-" is not valid at the start of a code block. Only identifiers, keywords, comments, "(" and "{" are valid.

Source Error:

Line 185: } Line 186: Line 187: @-o-keyframes moveclouds { Line 188: 0% { Line 189: margin-left: 1000px;"

If I eliminate the "at-rules", everything functions properly; however, the clouds remain stationary.

Answer №1

When working with CSHTML files in Visual Studio, the "@" sign signifies the start of .net code. To negate this, you simply need to double up the "@" sign. For example:

@@-webkit-keyframes moveclouds {
    0% {margin-left: 1000px;}
    100% {margin-left: -1000px;}
}

Alternatively, if you include the CSS code in a separate CSS file, a single "@" sign suffices. Like so:

@-webkit-keyframes moveclouds {
        0% {margin-left: 1000px;}
        100% {margin-left: -1000px;}
    }

Answer №2

Where do you typically store your CSS files? Everything is functioning properly http://jsfiddle.net/jsbot/cr5g6580/ Remember to paste it into the index.html file

<div id="clouds">
    <div class="cloud x1"></div>
    <!-- Let multiple clouds dance around -->
    <div class="cloud x2"></div>
    <div class="cloud x3"></div>
    <div class="cloud x4"></div>
    <div class="cloud x5"></div>
</div>

Also, add this content to style.css

/*Let's begin with establishing the cloud formation*/

/*The container will also act as the SKY*/

*{ margin: 0; padding: 0;}

body {
    /*To prevent a horizontal scroll bar during animation*/
    overflow: hidden;
}

#clouds{
    padding: 100px 0;
    background: #c9dbe9;
    background: -webkit-linear-gradient(top, #c9dbe9 0%, #fff 100%);
    background: linear-gradient(top, #c9dbe9 0%, #fff 100%);
    background: -moz-linear-gradient(top, #c9dbe9 0%, #fff 100%);
}

/*Final touches on the cloud shape*/
.cloud {
    width: 200px; height: 60px;
    background: #fff;

    border-radius: 200px;
    -moz-border-radius: 200px;
    -webkit-border-radius: 200px;

    position: relative; 
}

.cloud:before, .cloud:after {
    content: '';
    position: absolute; 
    background: #fff;
    width: 100px; height: 80px;
    position: absolute; top: -15px; left: 10px;

    border-radius: 100px;
    -moz-border-radius: 100px;
    -webkit-border-radius: 100px;

    -webkit-transform: rotate(30deg);
    transform: rotate(30deg);
    -moz-transform: rotate(30deg);
}

.cloud:after {
    width: 120px; height: 120px;
    top: -55px; left: auto; right: 15px;
}

/*Time to animate*/
.x1 {
    -webkit-animation: moveclouds 15s linear infinite;
    -moz-animation: moveclouds 15s linear infinite;
    -o-animation: moveclouds 15s linear infinite;
}

/*Varied speed, opacity, and positions of clouds for realism*/
.x2 {
    left: 200px;

    -webkit-transform: scale(0.6);
    -moz-transform: scale(0.6);
    transform: scale(0.6);
    opacity: 0.6; /*opacity based on size*/

    /*Speed is proportional to size and opacity*/
    /*Increase speed, decrease time in 's' = seconds*/
    -webkit-animation: moveclouds 25s linear infinite;
    -moz-animation: moveclouds 25s linear infinite;
    -o-animation: moveclouds 25s linear infinite;
}

.x3 {
    left: -250px; top: -200px;

    -webkit-transform: scale(0.8);
    -moz-transform: scale(0.8);
    transform: scale(0.8);
    opacity: 0.8; /*opacity based on size*/

    -webkit-animation: moveclouds 20s linear infinite;
    -moz-animation: moveclouds 20s linear infinite;
    -o-animation: moveclouds 20s linear infinite;
}

.x4 {
    left: 470px; top: -250px;

    -webkit-transform: scale(0.75);
    -moz-transform: scale(0.75);
    transform: scale(0.75);
    opacity: 0.75; /*opacity based on size*/

    -webkit-animation: moveclouds 18s linear infinite;
    -moz-animation: moveclouds 18s linear infinite;
    -o-animation: moveclouds 18s linear infinite;
}

.x5 {
    left: -150px; top: -150px;

    -webkit-transform: scale(0.8);
    -moz-transform: scale(0.8);
    transform: scale(0.8);
    opacity: 0.8; /*opacity based on size*/

    -webkit-animation: moveclouds 20s linear infinite;
    -moz-animation: moveclouds 20s linear infinite;
    -o-animation: moveclouds 20s linear infinite;
}

@-webkit-keyframes moveclouds {
    0% {margin-left: 1000px;}
    100% {margin-left: -1000px;}
}
@-moz-keyframes moveclouds {
    0% {margin-left: 1000px;}
    100% {margin-left: -1000px;}
}
@-o-keyframes moveclouds {
    0% {margin-left: 1000px;}
    100% {margin-left: -1000px;}
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Discover the color value within an array that begins with the "#" symbol

In my PHP code, I have written a function that extracts values from a CSS file and creates an array. Now, I need to loop through this array and create another array that only contains color values (strings starting with #). The challenge is that the length ...

CSS elements not aligned properly with nav bar

I'm having trouble getting the images to float next to the nav box on my WordPress site. If you take a look at you'll see what I mean. Any suggestions? ...

Resolving the Complete Cover Background Image problem

My current website has a full cover background image implemented using the following code: #back{ /* #back is a div */ position:absolute; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; backgroun ...

Tips for including background pictures in the jumbotron using bootstrap

I've recently delved into bootstrap just a couple of days ago. Now, I'm encountering an issue where I can't seem to add a background image to my entire webpage or even the jumbotron specifically. I've attempted to directly input the pa ...

Customized CSS scrollbar within a specific div

Is it possible to apply CSS to customize the scroll bar of a specific div without affecting the entire page layout? ...

Creating a grid layout with alternating patterns

I'm facing a challenge in creating an alternating grid layout using CSS, and it's proving to be more difficult than I anticipated. My goal is to design a layout with two boxes that alternate - first a box containing text, followed by a box displ ...

Is it possible to adjust the height of a panel in Jquery Mobile 1.4.5?

Currently working on a jqm project that is specifically for mobile devices. In this project, I have implemented two panels - one set to push and the other overlay. While one panel is positioned in the left corner of the screen, the other is located in the ...

What is the best method for incorporating CSS into an Angular application's embedded PowerBI report, which is displayed

Is there a way to incorporate external CSS or another method to apply styles to a PowerBI report embedded in an Angular application as an iframe? Specifically, I want to remove the scrollbar to ensure that the report seamlessly fits within the angular page ...

Exploring the process of implementing a dynamic background image feature in Vue

Looking to create a dynamic navbar and change its background image. I attempted the following: Here is my attempt: <b-navbar toggleable="lg" v-bind:style="headerStyle"> this.headerStyle = { backgroundImage: &a ...

Issues with borders and padding when using Bootstrap collapse in table components

I have a table nested inside another table, with a div surrounding it that has the collapse class from Bootstrap. This allows me to collapse it using the button in the first row. Here are the issues I'm facing: Is it possible to only display the ...

Unable to transmit a variety of text or variables via email through PHP

Can someone assist me in figuring out how to send more content in an email? I have been attempting to include additional information in the email, but haven't been successful. I am using ajax to call and send the email, however, only basic emails seem ...

Achieving consistent height for child divs in AngularJS when one div's size is changed dynamically using ng-repeat

For my project, I have set up a parent div with two child divs inside. The first child div contains a list generated using ng-repeat and has a border around it. This div's height adjusts based on the list items. Now, I need the second child div to mat ...

What is the correct way to properly define the height of a page containing an angular-split area?

I am currently working on a page that utilizes angular-split. Here is a snippet of the code: <div class="height-max"> <app-nav-menu></app-nav-menu> <as-split direction="horizontal"> <as-split-area> <route ...

Issue with align-items-* class in Bootstrap 4 causing alignment problems

Currently in the process of constructing a website utilizing the Bootstrap 4 framework and encountering difficulties with aligning items properly. For instance: Refer to Bootstrap 4 official documentation for row positioning Compare to my row positionin ...

What is the best way to insert an HTML data attribute string into a SCSS mixin using attr()?

I'm currently working on setting up a color scheme in SCSS that allows me to use the following HTML structure: <div class="swatch" data-bg="green">...</div> In my SCSS file, I have defined a mixin like this: @function color($key: ' ...

Error message displaying invalid property value for color in Bootstrap 4 :root

Attempting to utilize the bootstrap 4 :Root color property led to an error indicating that the value was invalid. Searching through the bootstrap documentation yielded no helpful information on this topic. Seeking assistance on how to properly use the bo ...

Create a div element that expands to occupy the remaining space of the screen's height

I am trying to adjust the min-height of content2 to be equal to the screen height minus the height of other divs. In the current HTML/CSS setup provided below, the resulting outcome exceeds the screen height. How can I achieve my desired effect? The foote ...

Include draggable functionality to a seating chart that is generated dynamically

I developed a function that generates table seats dynamically with equal spacing. The issue arises when I try to drag names from a list and drop them onto the seats as children. Unfortunately, I can't seem to achieve this functionality with the dynami ...

After running my CSS through the validator at http://www.css-validator.org/validator, I encountered a Parse Error. Any suggestions on how I can resolve this issue?

Here are the CSS codes for my media query section. @media (min-width:320px) and (max-width:575px){ .chakra{ width: 100%; float: unset; margin: auto; } } ...

Maintaining Flexbox layout without triggering item re-rendering for a new container

This is the unique layout I'm aiming to create: I am facing a challenging flexbox layout that needs to be implemented. One of the items in this layout is a Webgl player, which cannot be conditionally rendered due to the restarting issue it may cause. ...