CSS file keeps changing - visual-studio

I have the following CSS in my main.css file:
background-image:-moz-linear-gradient(top, #eeeeee, #aaaaaa) !important;
background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#eeeeee), to(#aaaaaa)) !important;
background-image:-webkit-linear-gradient(top, #eeeeee, #aaaaaa) !important;
background-image:-o-linear-gradient(top, #eeeeee, #aaaaaa) !important;
background-image:linear-gradient(to bottom, #eeeeee, #aaaaaa) !important;
background-repeat:repeat-x;
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffeeeeee', endColorstr='#ffaaaaaa', GradientType=0) !important;
Which keeps changing itself to:
background-image: linear-gradient(to bottom, #eeeeee, #aaaaaa) !important;
Why could this be happening? The selector is .navbar .nav which is defined in another CSS file too, the Bootstrap CSS file. Could it be that Visual Studio is automatically cleaning up duplicate definitions or something?
edit: It changes every few builds. I can't pinpoint what action is causing it to automatically change.

Those are browser based CSS tags:
This only works in mozilla:
background-image:-moz-linear-gradient(top, #eeeeee, #aaaaaa) !important;
Works in Chrome/Webkit based browsers:
background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#eeeeee), to(#aaaaaa)) !important;
background-image:-webkit-linear-gradient(top, #eeeeee, #aaaaaa) !important;
Actually this cross browser technique is somewhat deprecated in the release of CSS3. You need to find the corresponding CSS that works on the browser you are using.
It's not 'changing' just that, other CSS was ignored by the browser.

Have a look to see if there are any build events setup in Visual Studio. It's possible the project has been configured to run something like csstidy or a css minimizer that is attempting to cleanup duplicate properties.
Alternatively, if you're using source control (which I would hope you are), your source control may be configured to run a commit hook that does the same sort of thing. How that is configured will depend on the source control that you're using.
I wouldn't expect this to be a problem with a modern version of csstidy (or any other modern css optimising tool for that matter). However, if this is a project that you've inherited, it's possible it was setup some time ago with a tool that is now out of date.

Related

Unrecognized properties in css classes in .scss with blazor web assembly

I have written the following css class in my Blazor WASM project from the standard template:
.edit-field {
input {
border-top: none;
border-left: none;
border-right: none;
outline: none;
display: block;
}
span {
font-size: 12px;
}
}
This is a .scss file.
I then import it to the main css file, which is loaded to page.
It seems hard to have it broken, but I get this:
If I take the properties out of the class in the same file, the issue doesn't appear and all works expectably.
I don't mean this or any other .scss file to be a css isolation style sheet.
Please help.
Actually, this is no blazor issue at all. It appears, css does not support nested styling originally and all my time using it, I exploited an scss feature. I installed and configured Web Compiler extension in my VS-19 and it started working as I wanted.

SCSS changes display: flex; to display: grid;

I am making an internal website for a company.
We have to use Internet explorer.
I am using SCSS to make this work.
This works well in most cases except when I want to use flexbox
SCSS changes
.container{
display: flex;
}
to
.container{
display: grid;
}
How can I tell it to stop that?
Which version of internet explorer are you using?
Internet Explorer 6-9 do not support flexbox at all.
Internet Explorer 10 supports 2012 syntax for flexbox. So to get this to work cross browser for IE11 and other browsers you could do something like:
.container {
display: flex;
display: flexbox;
}
Browsers that do not support the 2012 syntax should ignore the 'flexbox' value however if IE10 encounters it, it should use that.
Internet Explorer 11 supports the current way of using flexbox. So if you are using IE11 and encountering this issue I would double check that your CSS isn't getting overridden unexpectedly.
EDIT
Just saw that you had tagged this as IE11 - I would double check that your values aren't being overriden somewhere. Flex is known to be buggy with IE11 but I can't imagine it would choose to switch to grid unless it was getting that value from a CSS file.

Debuging Asp.net core web with IIs is different than direct browsing

it's my first question here so i'm very excited :).
I moved recently from programing mvc-5/6 to asp.net core.
Now, i noticed when i debug my website i have several options:
-IIS
-SolutionName via cmd deployment
-Browse with
The funny thing is that when i deploy my web with IIS (F5) the browser doesn't get all my css references (which does not effect few of my privately cssed elements). But when i deploy it by the other 2 options i mentioned earlier it does work.
Now I've been searching a bit around for an explanation for that and find none.
Due to my lack of understanding in IIS i assume the problem is somewhere there and here are the following 2 questions:
1) Why are there such distinctions?
2) Does it matter eventually if the IIS doesn't respond as i expected when other debugging methods does respond correctly?
Thanks you!!!
A pic to show my code
.banner {
height: 350px;
width: 100%;
max-height: 50%;
max-width: 100%;
min-height: 20%;
min-width: 30%;
background-image: url('/ProfilePic/Profile.png');
background-size: cover;
}
I'd be careful here - it definitely does matter - as an answer for question 2.
When you switch from old MVC to core, you will realize that your "served" files go and lie in the wwwroot folder.
It is completely possible that you did not reference your CSS just right (as it differs from normal MVC's file structure). Also, be sure to use a relative path as opposed to an absolute one.
Have a look here:
Correct:
<link href="~/css/site-internal.min.css" rel="stylesheet" />
Incorrect:
<link href="~/wwwroot/css/site-internal.min.css" rel="stylesheet" />
<link href="http://localhost:5000/css/site-internal.min.css" rel="stylesheet" />
Could be that your problem is unrelated, but it is something to watch out for none the less.
EDIT
Your CSS's should definitely be able to load without regard to whichever way you run the program.
As an aside - the IIS option allows you to debug and step through your JS and could be quite useful.
What you want to do here is go into your browser dev tools (F12 most of the time), and go see if your CSS gets resolved correctly - you can continue once you know what your problem is.
Usually if something goes wrong in the process of loading CSS you wil get errors straight in the browser console
EDIT #2
Upon further perusal of your problem statement - I think it might be that your CSS is loaded correctly but you've got a problem with that image URL.
Please check the first answer here
The URL of the image inside a CSS file is relative to the path of the CSS file.
Therefore your solution will be something like this:
../ProfilePic/Profile.png
The .. moves up one level.

border-radius and IE 7 and IE8

I am applying border-radius on my layout and I having problems with IE 7 and IE8. I'm using the PIE.htc but I still can not do the compatibility works.
The code is:
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-top: 0;
-moz-border-top-left-radius: 4px;
-webkit-border-top-left-radius: 4px;
behavior: url(PIE.htc);
I'm testing in ieTester, can anyone help me?
if you use behavior: url(PIE.htc); then your Pie.htc should be in the same folder as your html page or master page.
your page's doctype should be XHTML or HTML5.
then my experience says its better to place the behavior code on top your css rule.
you better not use IE Tester as a trustful utility. It came up with a hand full of tools but not quite useful ones. its better to use IE 9, then change its browser and document mode in its developer tools. when you change them the whole page will reload in that mode. it even has quirk mode which is a complete total NIGHTMARE.
And if you can update your question with more facts about your code and browser.

My CSS images are not working on Windows Azure

I have a really strange situation where the CSS images are not displayed after the site is deployed to Windows Azure.
The images are part of the project (all the files and sub-folder are included in the project)
All images have a build action of Content
I'm not using relative path, always use absolute path on my views /content/path/to/images, but on CSS there is relative path url(../img/image.png) but this should not be a problem.
Static files are OK (CSS and Javascript work correctly), except for the images not showing up.
I deployed using git, but even with the Publishing Wizard I get the same result.
The images are there if I request them with the full path. This is "unreal" ;)
I'm must be neglecting a key thing here, but can't find it.
Thanks for your time.
Edit:
The image work via the img tag. So only the CSS images, which make no sense, they are working correctly locally.
I guess I can share the link, so you can see this thing live ;)
http://receivably.azurewebsites.net
Look at the top left logo, nothing appear, here is the HTML and CSS (this was working well a couple of deplyment ago, and work fine locally.
<a class="brand" href="/">name</a>
In the CSS:
.navbar .brand {
display: block;
width: 180px;
height: 34px;
padding-top: 0;
padding-bottom: 0;
margin-top: 2px;
margin-left: 10px;
overflow: hidden;
font-size: 18px;
line-height: 600px;
color: #333;
background: url(../img/logo.png) no-repeat 0 0;
}
And if we request the file directly it's there: http://receivably.azurewebsites.net/content/site/img/logo.png
The CSS file is placed in /content/site/css and images on /content/site/img.
May I add that I'm now unable to git push. Only the publishing wizard work. I've having LOTS of problem with that website on Azure, my other 3 app work flawlessly.
I think your css bundler is breaking things.
Here's what I see in your bundled CSS from the homepage (I've de-minified it a bit):
.brand
{
display:block;width:180px;height:34px;padding-top:0;padding-bottom:0;margin-top:2px;
margin-left:10px;overflow:hidden;font-size:18px;line-height:600px;color:#333;
background:url(../img/logo.png) no-repeat 0 0
}
Notice:
background:url(../img/logo.png) which may not be correct from the CSS which is executing from /bundles/
It should say:
../content/site/img/logo.png
Or as you said /content/site/img/logo.png
This would explain why it works locally (non bundled) and even in prior deployments -- because bundling related code may have changed recently. This is a classic release-time issue and it's one reason why turning on bundling full time (not just in Release mode) is wise, even though it takes an extra 0.500 seconds at Compile time. :-)
Hope that helps.

Resources