I have something like this in the body of my Html page.
<link rel="stylesheet" type="text/css" href="/untitled2.css">
I'm pretty sure this correct, but it's not working. What is wrong here?
You add your style sheets to the header such as
<head>
<!-- everything else -->
<link href="css/main.css"type="text/css" rel="stylesheet">
</head>
If you want to add it to the body you can style each element by using the style attribute such as ...
<body style="color:black;"></body>
or on each element itself
The answer is right inside the page you are looking at, try to figure out yourself as much as possible before asking the question here.
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/stackoverflow/all.css?v=7bbb71ecd5eb">
( from StackOverflow's page source )
Related
I am VERY new to html and have very limited skills so please bear with me.
I am trying to put an infinite image carousel with links on the front page of my website. But Bootstrap overrides my web styles. I thought I knew where my styles where( I obviously do not) and tried to add them after the carousel but it did not work.
I need the carousel in a specific place on the page.
I tried putting the carousel in a table or adding etc.(pretty much anything I could think of) all in vain. Not sure what to do as I am far from being a master code writer......
any help with this would be greatly appreciated!!!
Thank you in advance!!!
In almost all cases for bootstrap that I am aware of, Bootstrap styles will not override custom styles if you load your own styles after the bootstrap styles.
correct way:
<head>
<link rel="stylesheet" type="text/css" href="link-to-boostrap.css">
<link rel="stylesheet" type="text/css" href="custom-styles.css">
</head>
incorrect way:
<head>
<link rel="stylesheet" type="text/css" href="custom-styles.css">
<link rel="stylesheet" type="text/css" href="link-to-boostrap.css">
</head>
Stylesheets should always be in the header except for very specific circumstances.
If you are putting styles directly on the page in a <style> tag you can move them to the external style sheet following these instuctions: https://www.w3schools.com/css/css_howto.asp
I wish to put an href that links to a CSS file and a website.
How can i connect these two links into a working tag
<link href="https://fonts.googleapis.com/css?family=Cookierel="stylesheet">
and
<link href="class17.css"
Not sure I understand, why not use 2 different links?
Like this:
<link href="https://fonts.googleapis.com/css?family=Cookie" rel="stylesheet">
<link href="class17.css" rel="stylesheet">
So - Answering your question: "Could you add two links in a tag in a single html page?" - The answer is yes.
The first link is a Google Font. You can have as many as you want.
To link your CSS/SCSS stylesheet just add another link:
<link rel="stylesheet" href="style.css">
You cannot add multiple href's to the same link tag.
But you can add any number of link tags, as shown below:
<link href="https://fonts.googleapis.com/css?family=Cookie" rel="stylesheet">
<link href="class17.css" rel="stylesheet">
<link rel="stylesheet" href="custom.css">
For details check link tag
I have a very stupid question.
If I write a website layout in a css file and other stuff in a html file. How can I open the html but with the css layout in it?
Thanks!
You are looking for the <link ... /> element.
Read about it here:
http://www.w3.org/TR/html401/struct/links.html#h-12.3
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link
http://www.w3schools.com/tags/tag_link.asp
Linking your stylesheet works by putting
<link rel="stylesheet" type="text/css" href="yourcssfile.css" />
into the <head>-section of your HTML document.
Put <link rel="stylesheet" type="text/css" href="./yourstyle.css" /> in your <head>.
I have a problem where my css does not affect my html. I made a fiddle here
It worked when I wasn't trying to connect an external stylesheet and used style tags,
Thanks in advance to anyone who can help.
btw i tried
<link rel="stylesheet" type="text/css" href="index.css">
and it did not work.
Make sure you are linking it in your 'head' section of the HTML such as this:
<head>
<link href="index.css" type="text/css" rel="stylesheet" />
</head>
Also be sure to close the tag and that the style sheet you are linking is named 'index.css'
Edit:
HTML is split up into two main section tags: body and head. In a normal HTML page, the structure is like so:
<html>
<head>
</head>
<body>
</body>
</html>
The code I referenced at the beginning of this answer should be placed into the head section of the HTML page.
The fact that you are linking to simply index.css worries me. Is index.css in your site root? If so, specify that:
<link rel="stylesheet" type="text/css" href="/index.css">
As stated also by BuddhistBeast, check to make sure it's in between the head tags:
<head>
<link href="index.css" type="text/css" rel="stylesheet" />
</head>
Also check that you are referencing it correctly. If it is all in one folder, then
<link href="index.css" type="text/css" rel="stylesheet" />
is correct.
If it's in its own folder, named "css" for example, it should be written as:
<link href="css/index.css" type="text/css" rel="stylesheet" />
You put #button instead of input, #button in the css.
I'm a new web design student and I just learned about Cascading Style sheets and how to link them externally; however, I'm encountering a problem. I have the file linked in my <head> with no problem and the file directory is correct, but my changes are not showing up. If I had a <style> tag or attribute then my CSS works, but not from the external file. Any help?
<!DOCTYPE html>
<html>
<head>
<title>Protein Structures</title>
<link href="styles/main.css">
</head>
I make this same mistake when I'm in a rush. The problem is, you're linking the file correctly, but the browser doesn't know how to interpret the file. Is it a stylesheet, icon, alternate stylesheet? You need to add the rel attribute and set it equal to stylesheet.
<link rel="stylesheet" type="text/css" href="styles/main.css">
I'm not sure if type="text/css" is still mandatory. I know that when doing Javascript you don't have to have type="text/javascript".
Here's a good link explaining why.
You need to add what the relationship of the link is. Change your <link> tag to:
<link href="styles/main.css" rel="stylesheet">
You might want to take a look at the documentation for link types to understand why the rel is necessary.
try this i hope this is working.
<link type="text/css" rel="stylesheet" href="styles/main.css" media="all">