Template’s CSS is not styling the HTML - html

I've downloaded a template from w3layouts.com to make a website, and when I unzip the layout and try to open any of the HTML files, none of the CSS styling the page (it just looks as if there's no CSS).
When I inspect the HTML files, the CSS appears to be included in the header. For example, this is included in smartphone/blog.html's header:
<link href="smartphone/css/style.css" rel="stylesheet" type="text/css" media="all" />

You have to simply update this link tag
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
Because in this template href="smartphone/css/style.css". but actually css dictonary present in same level where other html file are. So you just update html file link tag to new href="css/style.css".
Is this template is for website, phone so you must set this template using index.php file to set dynamic path. but above solution is static not a dynamic. if you have to set dynamic path you must configure template step.

Related

<link rel="stylesheet" type="text/css" href="css2/css2.css"> not working

I've been trying to connect html with the CSS.
I've checked that:
The stylesheet path of the css is correct, and it is: css2/css2.css
The <link rel="stylesheet" type="text/css" href="css2/css2.css" /> code is well written and I think it is.
I also tried to try several code editors in case it was a preview problem, I've already tried Atom and brackets and the two do not show that the CSS gets connected.
HTML code :
The html close tag is written too at the bottom.
CSS
here is where the html and CSS file is placed
As you have mentioned in your statement that css files is css/css2.css
so it means you should link css file by this code.
<link rel="stylesheet" type="text/css" href="css/css2.css" />
You added css2 instead of css as folder name
This code will 100% work, Just make sure your HTML file and CSS2 folder need to be on same level (in same folder).
otherwise this CSS file not link to your HTML.

I’m having trouble linking my CSS file to my html

I created the CSS folder and named it. I added this to my header in HTML but the changes aren’t happening.
<link rel="stylesheet" type="text/css" href="haiku-styles-shaun.css" />
You mentioned you've created a CSS folder. Then include that folder name in the href
<link rel="stylesheet" type="text/css" href="CSS_FOLDER_NAME/haiku-styles-shaun.css" />
Probably your CSS file isn't in the same directory as your HTML file, you provided the wrong name of your CSS file (also check that your CSS file's extension is .css). Solve these and try again.
You have to include each file you need separately.
e.g.:
<link rel="stylesheet" type="text/css" href="haiku-styles-shaun.css/myButton.css" />
<link rel="stylesheet" type="text/css" href="haiku-styles-shaun.css/myPhoto.css" />
<link rel="stylesheet" type="text/css" href="haiku-styles-shaun.css/myFooter.css" />
Most user don't need all their style definition at the same time. To save bandwidth you have to choose.
You said that you created a folder but you didn't write it on the path. Try adding the css folder before the file name like this:
<link ref="stylesheet" type="text/css" href="folder/file.css" />
Furthermore I suggest you to include versioning in your css to avoid browser caching when you refresh. To do that every time you update your css change the number at the end in the link:
<link ref="stylesheet" type="text/css" href="folder/file.css?v=1" />
The <link> tag is used to link to external style sheets. You have to use something like this :
<link rel="stylesheet" type="text/css" href="Folder-Name/Stylesheet-Name.css">
Make sure that your href address is setup properly otherwise it won't load in your HTML page .
Note: The element is an empty element, it contains attributes only.
Note: This element goes only in the head section, but it can appear any number of times.
In HTML the <link> tag has no end tag. In XHTML the tag
must be properly closed.

Read a CSS file outside a main folder

I have html file in main(X-folder) which has CSS also, and I convert HTML to asp and i need to put inside a ASP[Y] folder..
My question since my CSS file is in main folder[X] how can i access on to it. suppose i am in X folder
my problem is that my File in Y folder which is converted to .asp file when i access its url i lost majority of its image and styles
how can i re-write my css
i tried few; still its not read the CSS
this is an image which describe my problems
<link href="X/css/style.css" rel="stylesheet" type="text/css" media="all" />
<link rel="stylesheet" href="X/css/responsiveslides.css">
<link href="X/css/iframeCSS.css" rel="stylesheet" type="text/css">
Have you tried using a leading slash (/ at the start)? It indicates to load the resource from the root of the web server. For example, with <link href="/X/css/style.css" ... /> it will load from example.com/X/css/style.css.
You could also use ../, which indicates to load a resource from a directory below (up a level). So if you were in directoy Y/, you could do <link href="../X/css/style.css" ... /> which loads the resource, again, at example.com/X/css/style.css.
The stylesheets included in your page are using relative paths.
Specify your stylesheet links with
runat=server
and prefix them with the virtual web root path
(~)
For example :
<link href="~/X/css/style.css" rel="stylesheet" type="text/css" media="screen" runat="server" />

Why isn't the style showing (colors, font,etc..) when I link my stylesheet to w3.css?

I have linked the w3.css stylesheet in my html (as suggested at w3schools) to utilize their responsive template but it doesn't appear to be working. I have linked it as such within the head tag of my html:
<link rel="stylesheet" href="w3.css">
<link rel="stylesheet" href="w3-theme-brown.css">
Am I missing something?
Make sure your CSS code is in your .css file, and your HTML and CSS files are in the same directory if you are using <link href="File.css" rel="stylesheet"> and not writing the directory.
Also, don't forget to put your link tags between opening and closing head tags.
It should look like the example I posted below.
If it's still not loading then it would to do with the location of your stylesheets(css).
Example - href="path/to/stylesheet"
The path would start from the current directory your HTML is in... so if you had index.html in the root directory and your css files a sub-directory then the example would look like this.
Example - href="css/w3.css"
Example - href="css/w3-theme-brown.css"
//HTML
<head>
<link rel="stylesheet" href="w3.css">
<link rel="stylesheet" href="w3-theme-brown.css">
</head>

Problems with base HTML tag in QWebView

I'm using base HTML tag in my page to obtain relative links to css files.
<base href="d:/Server/styles/">
<link rel="stylesheet" type="text/css" href="css/normalize.css">
<link rel="stylesheet" type="text/css" href="css/webflow.css">
<link rel="stylesheet" type="text/css" href="css/help-template-1.webflow.css">
Chrome browser understands this perfectly and styles are loaded for page. But QWebView doesn't want to load styles via base tag, although with absolute paths to css files page is shown perfectly in QWebView.
My question is: is it possible to make base tag work in QWebView? Or maybe there is another way to obtain relative links to files that QWebView understands well?
Solved: the problem was that QWebView doesn't add "file:///" to url, so it can be added in base tag before relative path. But more convenient choise is to set base url in setHtml function the same way as in base tag!
QUrl baseUrl("file:///d:/Server/styles/");
ui->webView->setHtml(textDocument->toPlainText(), baseUrl);