CSS order for multiple HTML files - html

I'm working on a navbar with a few links and I'm not completely sure if I should make a CSS file for each of the pages. E.I: There's the "About", "Shop" and "Contact" sections but they have the same background (which I wanna change). My question is: To make all of the website's sections share the same navbar I got to make a CSS file for each HTML file and paste the navbar code on all of the previously mentioned files?

You can put all CSS code within one file
or
you can separate it into multiple and copy the code.
I would prefer putting all in one because.this will cut down the size of the project.
Of there is more to it, let me know 👍
Edit:
Link the CSS to the HTML pages:
<link rel="stylesheet" type="text/css" href="myCss.css" />

Related

Background Image Wont Show

I'm trying to get this style to work for the body of the HTML page, it works when the style is applied within the tags but not when used with an external style sheet.
CSS Doesn't work with this code.
body {
background-image:url(img/geometric.jpg);
}
HTML Works here.
<body style="background-image:url('img/geometric.jpg');">
</body>
I want to use external styling for the whole page. I'm curious on how to fix this odd issue.
The path to the image must be relative to the CSS file that references it, not the HTML file that it will appear in.

Issues with resizing on my website

Hi I'm very new to coding in HTML and CSS and I have been trying to teach myself but I am struggling that being said I have been able to create this so far:
https://dimensionmediaml.000webhostapp.com/
Now the issue I have is that this website will work fine as long as it is being used on a certain sized monitor but anything smaller (have not been able to test anything larger) and the elements of the page end up looking like they are in the wrong positions
The site has proved to work at a resolution of 1920 x 1080
Any help would be really appreciated
Once again I am very new to this so please be patient with me :)
I have attached the code below and before people rip on me for putting the bootstrap code into the CSS sheet, it was the only way to get elements to display normally on my monitor when uploading the site to the server
HTML and CSS:
https://drive.google.com/drive/folders/0B_-tn2aR7tHXakZZQ1FleHVveDg?usp=sharing
You have Bootstrap but you don't override the css by using the way you did. Copy the styles you want and make a new document and name it custom.css, then upload that to the css folder on your server. Here is how to change the code in your html
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS: You can use this stylesheet to override any Bootstrap styles and/or apply your own styles -->
<link href="css/custom.css" rel="stylesheet">
Using width, height, top, bottom etc as percentages will never solve your problem. You must learn with #media queries in CSS3. Please visit this link http://learn.shayhowe.com/advanced-html-css/responsive-web-design/

Adding a separate CSS file in the body

I have provided a template and it contains many CSS files in head and the body is divided into header ,content and footer portions. I want to add to add bootstrap in order to utilize its grid system for its content part. But when ever I add bootstrap.css in head above or below all the style sheets in <head> content part and footer part renders well but my header portion of the body encounter certain design problems as many of the properties in other css files get overridden by its grid system.
All I want to know is, is there any hack I may be able to use the
bootstrap.css for the content part?
I have also tried linking the bootstrap file in <body> below the <header> and above the content portion(I know its not a good practice.) . but it also causes the similar problems for the header portion.
What you can do is make and download a custom bootstrap version from http://getbootstrap.com/customize/ that contains only the grid system and use that CSS in your web app.
No, you can't. You're going to either have to change your markup and adjust the styles accordingly, or use an ID wrapper and change the styles in your CSS to only target <header> under that specific ID.
You're better off adjusting your styles to fit bootstrap, though.
Try adding !important to the properties that you want to customize in your CSS file.
But the best way I see to solve your issue is modifying the bootstrap.css file adding your configurations and adding !important if necessary

External CSS not working only on one page

As title suggests. I've just uploaded this to my site: http://kach.olympe.in/llsif/rare.php
The layout is very simple, the CSS as well, but it doesn't show up. And it's only on this page. The homepage and another have exactly the same code skeleton (I basically copy/pasted and changed the content), but the CSS doesn't work. If I put it internally directly, then it works. Even when I change <link href="/css.css" rel="stylesheet" type="text/css" /> to the full path, the CSS still doesn't work and I seriously can't figure out why. Is there anything I'm doing wrong?
Try to add #charset "utf-8" into the first line of your css file may help.

Question about design of css with yui drop down menu

I'm trying to incorporate this yui drop down menu control in a web page:
http://developer.yahoo.com/yui/menu/
I have it working for the most part but I discovered that one of the css files that I need to link to as part of the control mess up the formatting for the rest of my web page. This is the css file in question:
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.8.2r1/build/reset-fonts-grids/reset-fonts-grids.css">
and this is the guilty line:
body{text-align:center;}
I'm not that experienced with css, but this doesn't seem like the friendliest design. This property is being assigned to the entire body section of the html file and could (or does in my case) impact content separate from the yahoo stuff. I know that I can fix this by putting a div tag around my stuff and setting the text-align property back to what I want it to be, but I don't feel this should be necessary. Or am I missing something here?
You do need to add a div around your body. Just redefine body style in your CSS file like
body{text-align:left;} and make sure your CSS file comes after yahoo's css file.
You can also do it inline like
<body style="text-align:left;">
This will override yahoo's body declaration for text-align.