Media Queries not working even though i have head tag - media-queries

My media tags dont seem 2 work even thought i have the viewport tag in my head. I am trying to change the font size when lowering the resolution. I am not sure what i am doing wrong but would love some help.
<? ?>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="main.css">
<meta charset="utf-8">
<link href='https://fonts.googleapis.com/css?family=Changa One' rel='stylesheet'>
<script src="main.js"></script>
</head>
<body style="background-color: #bdc3c7">
<div class="navBar">
</div>
<div class="container">
<div class="pLbl" style="font-family: 'Changa One';">
Enter Password to enter:
</div>
<div>
<input class="pInput" id="pInp" type="password"></input>
</div>
<div>
<div class="tooltip">
<button class="pBtn" onclick="pLogin()"></button>
<span class="tooltiptext">Submit</span>
</div>
</div>
</div>
</body>
</html>
<style>
.pLbl {
font-size: 24px;
color: rgb(50,50,50);
}
#media screen and (max-width: 640px)
{
.pLbl {
font-size 12px;
}
}
</style>

It's just because you forgot the colon after font size on media query :)
PS: While modern browsers have a code correction for invalid HTML, I suggest you put style tag in your head, declare the doctype and write your inputs with self-close tag.

Related

vuejs v-cloak placement while assets download

Currently I'm making vuejs SPA, and the build size is pretty big, so I want to place some loading indicator instead of blank page while vue is downloading its assets.
I've found out that in this case, the solution is v-cloak, but what I dont understand is, in every example the v-cloak is putted inside index.html, whereas in my project src there are no index.html, there is only main.js and vue.app.
there are index.html, but is located inside public folder(which i think its a build file?).
nevertheless, I've tried to put v-cloak directive inside Vue.app, and its still showing blank page while vue downloading its assets. please point me in the right direction.
thanks for all the help.
here's my App.vue:
<template>
<div id="app">
<div v-cloak>
<div class="v-cloak--inline"> <!-- Parts that will be visible before compiled your HTML -->
<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
<span class="sr-only">Loading...</span>
</div>
<div class="v-cloak--hidden"> <!-- Parts that will be visible After compiled your HTML -->
<!-- Rest of the contents -->
<router-view />
</div>
</div>
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
<style>
[v-cloak] .v-cloak--block {
display: block;
}
[v-cloak] .v-cloak--inline {
display: inline;
}
[v-cloak] .v-cloak--inlineBlock {
display: inline-block;
}
[v-cloak] .v-cloak--hidden {
display: none;
}
[v-cloak] .v-cloak--invisible {
visibility: hidden;
}
.v-cloak--block,
.v-cloak--inline,
.v-cloak--inlineBlock {
display: none;
}
</style>
and when I put some loading indicator in public/index.html, it work, but how do I remove it after vue finished loading?
heres my public/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= webpackConfig.name %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= webpackConfig.name %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
Loading
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
v-cloak is supposed to be used on the application's mounting point (the el specified in new Vue()), not within a component. Vue does not process v-cloak anywhere else but the mounting point, so it has no effect in App.vue.
To use v-cloak:
In public/index.html, add the v-cloak attribute to div#app, and a <style> block to hide it:
<div id="app" v-cloak></div>
<style>
[v-cloak] {
display: none;
}
</style>
Adjacent to div#app, add a loading icon, and style it so that it's hidden when the v-cloak attribute is removed (i.e., :not([v-cloak])):
<div class="loading">
<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
</div>
<style>
.loading {
display: grid;
place-content: center;
}
#app:not([v-cloak]) ~ .loading {
display: none;
}
</style>
demo

dojo contents appear briefly and then they disappear

I have this simple page that should display a bordercontainer with top, bottom and center regions. When you run it, contents briefly appear and then they disappear. Firebug shows no error and i can't see anything wrong with the code.
thank you.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<link rel="stylesheet" href="http://js.arcgis.com/3.13/esri/css/esri.css" />
<link rel="stylesheet" href="http://js.arcgis.com/3.13/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.13/dojox/grid/resources/Grid.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.13/dojox/grid/resources/claroGrid.css">
<script src="http://js.arcgis.com/3.13/"></script>
<script >
var dojoConfig = {
parseOnLoad: true
}
require(
['dijit/layout/BorderContainer', 'dijit/layout/ContentPane',
"dojo/parser",
"dojo/domReady!" ],
function(BorderContainer, ContentPane, parser) {
parser.parse();
});
</script>
</head>
<body class="claro" style="font-family: Verdana; font-size: 11px;">
<div data-dojo-type="dijit.layout.BorderContainer" data-dojo- props="design:'headline',gutters:false" style="width:100%; height:100%;">
<div data-dojo-type="dijit.layout.ContentPane" data-dojo- props="region:'top'">
top
</div>
<div data-dojo-type="dijit.layout.ContentPane" data-dojo- props="region:'bottom'">
bottom
</div>
<div data-dojo-type="dijit.layout.ContentPane" data-dojo- props="region:'center'">
center
</div>
</div>
</body>
</html>
I did some more research.
After fixing the unwanted spaces in "data-dojo- props" and replaced by "data-dojo-props" the same behavior as what you describe in your question arises.
Actually, it look like it is a sizing issue.
The border container will take the size of its parent. However, if it fail getting it. It size will be 0, thus everything disappearing.
You see the content at first because the border container isn't loaded yet.
As soon as it gets loaded, the content is gone.
In the below snippets, I force the size of the borderContainer's parent (the body tag in this example) to be 300px by 150px
The you can see that the content stays.
(Note: I also changed the data-dojo-type to use the slash notation. the dot notation is for old dojo version.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<link rel="stylesheet" href="http://js.arcgis.com/3.13/esri/css/esri.css" />
<link rel="stylesheet" href="http://js.arcgis.com/3.13/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.13/dojox/grid/resources/Grid.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.13/dojox/grid/resources/claroGrid.css">
<script src="http://js.arcgis.com/3.13/"></script>
<script >
var dojoConfig = {
parseOnLoad: true
}
require(
['dijit/layout/BorderContainer', 'dijit/layout/ContentPane',
"dojo/parser",
"dojo/domReady!" ],
function(BorderContainer, ContentPane, parser) {
parser.parse();
});
</script>
</head>
<body class="claro" style="width:300px; height:150px" style="font-family: Verdana; font-size: 11px;">
<div data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline',gutters:false" style="width:100%; height:100%;">
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'">
top
</div>
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'bottom'">
bottom
</div>
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'">
center
</div>
</div>
</body>
</html>
As you can see in below screenShot-
We are able to see contentPane however it shows a error for contents:
So I guess this weird behaviour may be happening because of content for these pane.
Try to add contents in it and see if you are getting same error or fixed in your environment.

vertical align column with customized css on bootstrap 3

I'm trying to use customized css on bootstrap 3, but failed. What I want is(on wide screen):
combo box located in vertical center on the left side.
The h3 Title located in center(This item is the highest).
The date mark located in bottom(This item is the shortest) on the right side.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>test</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js" />
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js" />
<![endif]-->
<style>
.vcenter {
vertical-align:middle
}
.vbottom {
vertical-align:bottom
}
</style>
</head>
<body>
<div class="container">
<form class="form-horizontal bg-info" role="form">
<div class="form-group">
<div class="col-md-4 vcenter">
<div class="input-group input-group-lg">
<select class="form-control">
<option>a</option>
<option>b</option>
</select>
</div>
</div>
<div class="col-md-6">
<h3>Title</h3>
</div>
<div class="col-md-2 vbottom">
<p class="text-right"><small>2014.09.03</small></p>
</div>
</div>
</form>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" />
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js" />
</body>
</html>
Try this:
for vertical align use display: table-cell
.vcenter {
vertical-align:middle;
display:table-cell;
}
Use inline padding-top, here is the demo
left column: height 46px, add 5 px (=(56-46)/2)
middle column: height 56px
right column: height 30px, added 26 px(=56-30)
Cons:
Should manual calculate.
This method works on wide screen. It will get extra height on mobile phone.

how to change color of text for WinJS.UI.ToggleSwitch

I am using a Toggle Switch in the settings pane. Problem is that the text in the title and labelOff, labelOn is not visible. I am not sure how can I change the front color or styles from the WinJS.UI.ToggleSwitch so that this text start displaying. Any examples will be highly appreciated.
Here is my html.
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div class="mypage fragment"
id="mysettings"
data-win-control="WinJS.UI.SettingsFlyout" data-win-options="{width:'narrow'}">
<div class="win-header">
<button onclick="WinJS.UI.SettingsFlyout.show()" class="win-backbutton">
</button>
<div class="win-label">My Settings</div>
</div>
<div class="mytoggle" data-win-control="WinJS.UI.ToggleSwitch" data-win-options="{ title:'Test', labelOff: 'Close', labelOn:'Open', checked: true}"></div>
</div>
</body>
</html>
Below is my css
.fragment.mypage .mytoggle .win-title .win-labelOff{
color: green; }
you can refer the css styling classes for WinJS.UI.ToggleSwitch here.
default.js:
app.onsettings = function onsettings(e)
{
e.detail.applicationcommands = {
about: { title: 'About', href: '/pages/settings/about.html' },
};
WinJS.UI.SettingsFlyout.populateSettings(e);
}
/pages/about/about.css:
.myflyout .win-content .mytoggle .win-title
{
color: blue;
}
/pages/about/about.html page:
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="/pages/settings/about.css" rel="stylesheet" />
</head>
<body>
<!-- BEGINSETTINGFLYOUT -->
<div class="myflyout" data-win-control="WinJS.UI.SettingsFlyout"
data-win-options="{settingsCommandId:'about'}">
<div class="win-ui-light win-header" >
<button type="button" onclick="WinJS.UI.SettingsFlyout.show()"
class="win-backbutton"></button>
<div class="win-label">About</div>
<img src="/images/smalllogo.png" style="position: absolute; right: 20px;"/>
</div>
<div class="win-content">
<div class="mytoggle" data-win-control="WinJS.UI.ToggleSwitch"
data-win-options="{title: 'example of toggle'}" >
</div>
</div>
</div>
<!-- ENDSETTINGSFLYOUT -->
</body>
</html>
As of 2016 I failed doing this with ".win-title". Instead used ".win-toggleswitch-header".

how to use dojo.setStyle for setting the color

I am having two questions with respect to this above program
The Width of the button is appearing very small
How can I change the color of the button programatically means onclick of this button I have a function?
dojo.setStyle("bid" ,"color" ,"red");
But both aren't working
<html>
<head>
<link rel="stylesheet" type="text/css"
href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css"/>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js"
djConfig="parseOnLoad: true">
</script>
<script>
dojo.require("dijit.form.Button");
</script>
</head>
<body class="claro">
<div dojoType="dijit.form.Button" id="bid" style="color: green;width: 335px; font-size:12px;"></div>Save
</body>
</html>
The method you want is style, not setStyle, so use:
dojo.style("bid", "color", "red");
To make the button bigger, put some text in the div:
<div dojoType="dijit.form.Button" id="bid" style="color: green;width: 335px; font-size:12px;">Save</div>