私はReactJSを使ってWebアプリケーションを作成したかったのです。私はbootstrap
が働いているが、今はCSS
が働きたい。私の方法が私のCSS
がやろうとしていることを行うのに有効なのはなぜですか?どうしてこのようにCSSを使用できないのですか?
#portfolio {
text-align: center;
}
はここに私のindex.js
ファイルです:
<!DOCTYPE html>
<html>
<head>
<title>My website</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="index.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/react.js"></script>
<script src="https://unpkg.com/[email protected]/dist/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.16/browser.js"></script>
</head>
<body>
<div id="firstBar"></div>
<script type="text/babel" src="index.js"></script>
</body>
</html>
はここに私のindex.css
ファイルです:
は、ここに私のindex.html
ファイルです、あなたのCSSはIDを参照しているため、それはだよう
var TitleBar = React.createClass({
render: function() {
return(
<div className="container">
<button id="portfolio" type="button" className="btn btn-primary">Portfolio</button>
<button type="button" className="btn btn-primary">About</button>
<button type="button" className="btn btn-primary">Contact</button>
</div>
);
}
});
ReactDOM.render(<TitleBar />, document.getElementById('firstBar'));
あなたは代わりに '' .portfolio'の#1 portfolio'を使用しているので? –
@MichaelCoker私はそれを変更しましたが、それはまだ動作しません。 – chompy
あなたのスタイルシートには何もありますか?それとも、その1つのルールですか? – jmargolisvt