复选框没有在Firefox中设置样式但Chrome很好(Checkbox not styled in Firefox but Chrome fine)
我有一个复选框,我在css中设置了样式,而没有使用任何标签选择器。 我将在一个页面上使用它,该页面有10个复选框,周围没有标签,因此不能使用任何代码。
我在Chrome上运行良好,但FireFox 29无法正确呈现复选框,我不知道为什么!
我在这里创建了一个代码笔。 http://codepen.io/anon/pen/ACKrH
HTML
<div> <input type="checkbox" value="None" id="cb" name="check" checked /> <label for="cb">My label</label> </div>
CSS
input[type="checkbox"] { -webkit-appearance: none !important; -moz-appearance: none !important; appearance: none !important; background-color: #dde1e2; border-radius: 5px; padding: 8px; margin-bottom: 0; display: inline-block; position: relative; cursor: pointer; height: 20px; width: 20px; } input[type="checkbox"]:active, input[type="checkbox"]:checked:active { box-shadow: 0 1px 2px rgba(0,0,0,0.05), inset 0px 1px 3px rgba(0,0,0,0.1); } input[type="checkbox"]:checked { background-color: #5fa8cf; border: 1px solid #5fa8cf; color: #777; } input[type="checkbox"]:checked:after { content: '\2714'; font-size: 14px; position: absolute; top: 0px; left: 3px; color: white; }
有任何想法吗?
I have a checkbox which I have styled in css, and not using any of the label selectors. I will be using this on a page which has 10 checkboxes and no labels around them, so can't use any of that code.
I have this working fine with Chrome, but FireFox 29 fails to render the checkboxes properly and I am not sure why!
I have created a code pen here. http://codepen.io/anon/pen/ACKrH
HTML
<div> <input type="checkbox" value="None" id="cb" name="check" checked /> <label for="cb">My label</label> </div>
CSS
input[type="checkbox"] { -webkit-appearance: none !important; -moz-appearance: none !important; appearance: none !important; background-color: #dde1e2; border-radius: 5px; padding: 8px; margin-bottom: 0; display: inline-block; position: relative; cursor: pointer; height: 20px; width: 20px; } input[type="checkbox"]:active, input[type="checkbox"]:checked:active { box-shadow: 0 1px 2px rgba(0,0,0,0.05), inset 0px 1px 3px rgba(0,0,0,0.1); } input[type="checkbox"]:checked { background-color: #5fa8cf; border: 1px solid #5fa8cf; color: #777; } input[type="checkbox"]:checked:after { content: '\2714'; font-size: 14px; position: absolute; top: 0px; left: 3px; color: white; }
Any ideas?
原文:https://stackoverflow.com/questions/23838477
最满意答案
确保将您的
body-parser
代码放在所有路径之上var bodyParser = require('body-parser'); var app = express(); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false }));
Make sure to put your
body-parser
code above all the routesvar bodyParser = require('body-parser'); var app = express(); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false }));
相关问答
更多-
您需要记住JavaScript是异步的。 调用searching ,数据库查询是异步发出的,函数在数据库为您提供结果之前返回。 换句话说,您的searching功能不会给您带来的结果 function(err, rows, fields) { if (err) throw err; if(!validator.isNull(rows)) { return rows[0].leadid; }else { ...
-
您不能在GET请求中拥有正文。 所以改变这个: app.post('/sendEmail', function(req, res) { var answers = req.body.answers; // whatever }) 和这个: $http.post('http://localhost:5000/sendEmail', { answers: answer }) You cannot have a body in a GET request. So change this: ...
-
Express不断收到request.body作为未定义的JSON对象(Express keeps getting request.body as undefined JSON object)[2024-03-06]
你需要使用body parser。 var bodyParser = require('body-parser') app.use(bodyParser.json()); 看到: https://github.com/expressjs/body-parser 您可能还需要添加: contentType: 'application/json', 在你的.ajax()选项中。 You need to use the body parser. var bodyParser = require('body- ... -
Request.body是空对象(Request.body is empty object)[2023-08-19]
将JSON , FormData , Blob对象或字符串传递给body 。 Request.body不期望JavaScript对象。 body: JSON.stringify(data) Pass JSON, FormData, Blob object or string to body. Request.body does not expect a JavaScript object. body: JSON.stringify(data) -
使用身体分析中间件。 你可以检查; https://github.com/expressjs/body-parser Use body-parsing middleware. You can check; https://github.com/expressjs/body-parser
-
Koa默认不解析请求体,你需要添加一个用于正文解析的中间件,例如koa-body 。 var app = require('koa')(), router = require('koa-router'), koaBody = require('koa-body')(); app.use(router()); app.post('/users', koaBody, function *(next) { console.log(this.request.body); ...
-
确保将您的body-parser代码放在所有路径之上 var bodyParser = require('body-parser'); var app = express(); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); Make sure to put your body-parser code above all the routes var bodyParser = require ...
-
JavaScript的 function getCleanObject(oldObject) { var newObject = {}; for (var property in oldObject) { var value = oldObject[property]; if (value) newObject[property] = value; } } 说明 您可以从创建一个新的干净Object var newObject = {}; // sa ...
-
app.use(express.bodyParser());默认解析所有查询字符串输出app.use(express.bodyParser()); ..你的问题的简单解决方案是尝试记录req.query ,类似于 console.log(req.query); move app.use(express.bodyParser())); ahead of app.use(express.static(path.join(__dirname, 'public')));
-
发出包含JSON正文的POST请求时,request.body为空(request.body is empty when issuing POST requests containing JSON body)[2023-05-17]
如果您遇到快递请求主体的问题,首先要检查的是应用程序是否配置为使用bodyParser ,即: app.use(express.bodyParser()); 在这种特殊情况下,您可以检查您的实现是否与示例匹配。 If you ever have problems with a request body in express, the first thing you should check is if the application is configured to use bodyParser, i.e ...