[Node. js learning] -- (6) -- Bootstrap, node. js -- bootstrap
Use Bootstrap
Use the CDN source of the Chinese network to add bootstrap: Modify F: \ nodejs-bower \ views \ index. ejs
<! DOCTYPE html>
<Html lang = "zh-CN">
<Head>
<Title> <% = title %> </title>
<Link rel = "stylesheet" href = "http://cdn.bootcss.com/bootstrap/3.3.2/css/bootstrap.min.css">
<Link rel = 'stylesheet 'href = '/stylesheets/style.css'/>
</Head>
<Body>
<Div class = "well jumbotron">
<H1> <% = title %>
<P> This is a simple hero unit, a simple jumbotron-style componentfor calling extra attention to featured content or information. </p>
<P> <a class = "btn-primary btn-lg" href = "#" role = "button"> Learn more </a> </p>
</Div>
<Script src = "http://cdn.bootcss.com/jquery/1.11.2/jquery.min.js"> </script>
<Scriptsrc = "http://cdn.bootcss.com/bootstrap/3.3.2/js/bootstrap.min.js"> </script>
</Body>
</Html>
Running effect:
We split the index. ejs page into three parts: header. ejs, index. ejs, and footer. ejs for website page modularization.
Views/
── Error. ejs
├ ── Footer. ejs
── Header. ejs
── Index. ejs
Header. ejs
<! DOCTYPE html>
<Html lang = "zh-CN">
<Head>
<Title> <% = title %> </title>
<Link rel = "stylesheet" href = "http://cdn.bootcss.com/bootstrap/3.3.2/css/bootstrap.min.css">
<Link rel = 'stylesheet 'href = '/stylesheets/style.css'/>
</Head>
<Body>
Footer. ejs
<! DOCTYPE html>
<Html lang = "zh-CN">
<Head>
<Title> <% = title %> </title>
<Link rel = "stylesheet" href = "http://cdn.bootcss.com/bootstrap/3.3.2/css/bootstrap.min.css">
<Link rel = 'stylesheet 'href = '/stylesheets/style.css'/>
</Head>
<Body>
Index. ejs
<% Include header. ejs %>
<Div class = "welljumbotron">
<H1> <% = title %>
<P> This is a simple hero unit, asimple jumbotron-style component for calling extra attention to featuredcontent or information. </p>
<P> <a class = "btn-primarybtn-lg" href = "#" role = "button"> Learnmore </a> </p>
</Div>
<% Include footer. ejs %>
Same running effect (omitted)
Reference http://blog.fens.me/nodejs-express4/