简体   繁体   English

EJS:我怎样才能让我的内容占据整个屏幕(例如宽度:100%)?

[英]EJS: How can I make my content take up the whole screen (e.g. width: 100%)?

so I'm a beginner and I am learning HTML, CSS, JS, EJS, Express and making web apps.所以我是初学者,我正在学习 HTML、CSS、JS、EJS、Express 和制作 web 应用程序。 Basically, I'm trying to learn full stack.基本上,我正在尝试学习全栈。 I am currently working on a web app and I'm using EJS as my templating engine as well as static HTML files for the non-dynamic parts of my web app. I am currently working on a web app and I'm using EJS as my templating engine as well as static HTML files for the non-dynamic parts of my web app.

I can get the HTML working perfectly in EJS templates, however I'm experiencing issues getting my CSS to work.我可以让 HTML 在 EJS 模板中完美工作,但是我在让 CSS 工作时遇到问题。

I have set up routes for serving static files:我已经设置了提供 static 文件的路线:

app.set("view options", { layout: false });
app.use(express.static(__dirname + "/public"));

CSS works, seemingly perfectly except for the fact that my content doesn't take up the whole page. CSS 工作,除了我的内容没有占据整个页面这一事实之外,看起来很完美。 It's like the width: 100% property doesn't work, or maybe it does but EJS has certain constraints or something that I do not know about.就像 width: 100% 属性不起作用,或者它可能起作用但 EJS 有某些限制或我不知道的东西。

Again, I am a beginner and I appreciate any help you can give me.同样,我是一个初学者,我很感激你能给我的任何帮助。

EJS is just an HTML-template engine, which have no difference from the usual one written by HTML(in the simplest case). EJS 只是一个 HTML 模板引擎,它与通常由 HTML 编写的引擎没有区别(在最简单的情况下)。 So, you should try to find what's wrong in your CSS styles;所以,你应该试着找出你的 CSS styles 有什么问题;

Even if you have not configured your node server to give you the correct CSS styles, you can simply write the necessary styles inside the tag in the EJS file itself and check if everything works as expected.即使您没有配置节点服务器来为您提供正确的 CSS styles,您也可以简单地编写必要的 styles,并检查 EJS 文件本身的标签中的所有内容是否按预期工作。

Also, to check why your HTML elements do not look as intended, use the developer console in your browser.此外,要检查为什么您的 HTML 元素看起来不像预期的那样,请使用浏览器中的开发人员控制台

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使我的 CSS 切换 state 变化更平滑,例如通过过渡? - How can I make my CSS toggle state changing smoother e.g. with a transition? 如果没有屏幕,screen.width的值是什么? 例如机器人 - What value is screen.width if there is no screen? e.g. bots 除了用户输入的值在 1 - 100 之间(例如年龄框),我如何才能制作我的表单 - How can I make my form only except values that the user entered that are between 1 - 100 (e.g like for the age box) 如何使对话框覆盖整个屏幕? - How can I make my dialog box cover the whole screen? 在firefox中,如何在本地文件(例如,file:/// C:/play/my.html)中运行javascript - In firefox, how can I run javascript in local file e.g., file:///C:/play/my.html 如何传递带有http的整个URL,例如“ http://www.facebook.com”作为参数,以节点/表达“ /:param”? - How do I pass a whole URL with http e.g. “http://www.facebook.com” as a parameter to node/express “/:param”? 如何使SVG元素(例如矩形)scrollIntoView? - How to make a svg element (e.g. rectangle) scrollIntoView? 我可以分配对象运算符吗? “例如+,-” - Can I assign Objects operators? “e.g. +, -” 如何生成特定颜色的随机阴影列表? (例如橙色的随机阴影) - How can I generate a list of random shades of a particular color? (e.g. random shade of orange) 如何在PHP中使用Ajax从网站(例如IMDB)中获取数据 - How can I fetch data from a website (e.g. IMDB ) using Ajax in PHP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM