最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Integration of CSS, Javascript and HTML - Stack Overflow

programmeradmin1浏览0评论

I have absolutely zero idea about web design.

If you go to .php you will find that the CSS, JavaScript and HTML codes have been separately mentioned. How do I integrate them? The CSS and JavaScript should go inside head tag?

I have absolutely zero idea about web design.

If you go to http://caroufredsel.frebsite.nl/examples/carousel-lightbox-tooltip.php you will find that the CSS, JavaScript and HTML codes have been separately mentioned. How do I integrate them? The CSS and JavaScript should go inside head tag?

Share Improve this question edited Feb 13, 2019 at 19:42 halfer 20.4k19 gold badges109 silver badges202 bronze badges asked May 28, 2012 at 8:39 user1155386user1155386 1851 silver badge6 bronze badges 3
  • How do you mean integrate them? Do you want to have all the code in the HTML-file? – Christofer Eliasson Commented May 28, 2012 at 8:43
  • Googling for html example, css example, javascript example could have taken less time than posting here – archil Commented May 28, 2012 at 8:49
  • 2 +1 I think the simplicity of the question is rather unique. Even when Googling now the results are very different and can be confusing to a newer. – arttronics Commented May 28, 2012 at 8:57
Add a ment  | 

3 Answers 3

Reset to default 3

Yes, you are correct that they can be integrated in the Head Section.

For example:

<style type="text/css">

    /* Place the contents of the file.css here */

</style>


<script type="text/javascript">

    // Place the contents of the file.js here.

</script>

You need to have something like

<link rel="stylesheet" href="css/style.css">
<script src="js/script.js"></script>

inside the head of your .html file.

It would be even nicer if you could put your JavaScript not in the head, but at the end of the body tag.

This implies you have

  • an .html file
  • a folder called css which contains a style.css file where you have... all your CSS of course
  • a folder called js which contains a script.js file where you have your JavaScript code

If it is necessary you can have all the code in one file.

In a very simplified way:

<html>
    <head>
        <script>/*javascript goes here*/</script>
        <style>/*css goes here*/</style>
    </head>
    <body>/*content goes here*/</body>
</html>
发布评论

评论列表(0)

  1. 暂无评论