How to import a css file in a markdown? [duplicate] - css

This question already has answers here:
How to use CSS in Markdown?
(4 answers)
Closed 10 hours ago.
This post was edited and submitted for review 8 hours ago.
I have tried <link rel="stylesheet" type="text/css" href="style.css"> in markdown but that didn't work. Is there a way to do that?
I know using a style tag can work, but I wonder how to import a css in markdown. So I think the problem is different with How to use CSS in Markdown? . The link doesn't mention importing css in a markdown.

It should work, you can add css in three different ways
inline style
example : <p style="color: red">Username </p>
internal styling with the help of tag
example : <style> p {color: 'red'}</style>
external link
Using link tag, we can load css into html file
<link rel="stylesheet" href="<source-link>" />

Related

react font-awesome icon is not showing in css content [duplicate]

This question already has answers here:
Font Awesome 5 on pseudo elements shows square instead of icon
(3 answers)
Font Awesome 5 Choosing the correct font-family in pseudo-elements
(1 answer)
Closed 4 years ago.
I'm trying to use fontawesome in React in css content and getting blank square instead of the icon. When using normally with html tag, it's working properly.
I installed the npm react-fontawesome and also pasted the cdn in my public index.html. I do prefer to use it in the old way (such as with pure js) and the normal html tags are working.
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
css:
.answer-selected::before {
font-family: FontAwesome;
content: '\f00c'
}
Same icon is working as a html tag:
<i class="fas fa-check"></i>
Any ideas?
Thanks in advance

Bootstrap won't work properly

I've tried this exact code on my other computer and once run it is shown differently. Could you correctly show me how I should insert the references? Also how could I override the style of the default bootstrap?
I think that's all the info you need, but if you need anything else just ask.
I assume that you html file is inside wwwroot folder, so:
<title>Bootstrap 101 Template</title>
<link rel="stylesheet" href="lib/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="lib/bootstrap/dist/css/bootstrap.min.css">
<script src="lib/bootstrap/dist/js/bootstrap.min.js"></script>
<style>
...
</style>
</head>
Where you have:
<link href="~/lib/bootstrap/dist/css/bootstrap.css" rel="stylesheet">
Remove the ~.
I believe that the ~ is a Windows only thing used for finding the path. If it's your mac where Bootstrap is not working, then I'm 98% sure that was the issue. ~ isn't used in the mac environment for paths like it is on Windows.
You will also need to do that for your other paths being found this way.
Going in and changing the bootstrap CSS can get a little complicated so I usually create a new CSS file with my edits. Since CSS is cascading stylesheets, I make sure that my CSS file is the last stylesheet in the head section so it overrides the stylesheets above it.
The location of your CSS file in reference to your HTML file will determine what the file path looks like in your reference. If your HTML file is in the root directory, the reference/paths mentioned in the other answers should work.
As stated above:
<link href="~/lib/bootstrap/dist/css/bootstrap.css" rel="stylesheet">
Remove ~.
If you want to overwrite CSS place the default.css or your own css after the one you want to overwrite for example:
<!-- Bootstrap and Custom CSS Style Sheets -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/default.css">

Import more than one css file to html page

I trying to import 2 css files as follows:
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/bootstrap.css">
And for some reson its doesnt working, What would be the problem?
The order of loading css really matters, I think the bootstrap.css file has some class or id which has the same id as you have in general.css. The last css file will cover the previous one.
Correct! The order of loading css really matters. Please check the order you are loading and could you please post your exact issue? Like which part are you not able to get in your html page? #user11001

why css file include in header section but js file in the bottom [duplicate]

This question already has answers here:
JavaScript at bottom/top of web page?
(10 answers)
Closed 7 years ago.
Hi can any body help me....why css file include in header section but js file in the last of the page. can i also include the css file in bottom of the file.
<!DOCTYPE html>
<html>
<head>
<link type="text/css" href="myFolder/style.css" rel="stylesheet">
</link>
</head>
<body>
<div>
<p>Paragraph 1 in the div.</p>
<p>Paragraph 2 in the div.</p>
</div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</html>
When a browser encountered a tag pointing to an external resource, the browser would stop parsing the HTML, retrieve the script, execute it, then continue parsing the HTML. In contrast, if the browser encountered a for an external stylesheet, it would continue parsing the HTML while it fetched the CSS file (in parallel).
The purpose of the "put stylesheets at the top and scripts at the bottom" rule is that, in general, it's the best way to achieve optimal progressive rendering, which is critical to the user experience.
Hence, the widely-repeated advice to put stylesheets first – they would download first, and the first script to download could be loaded in parallel.
However, modern browsers (including all of the browsers I tested with above) have implemented speculative parsing, where the browser "looks ahead" in the HTML and begins downloading resources before scripts download and execute.
For detail info refer this link :
Css before Js

How to provide a stylesheet for rendering PDFs?

Following on from a previous question, I have managed to get the 'screen' version (HTML) of a document into PDF format using the <cfdocument format="pdf"> tag. I need the styling of the PDF to be different to that of the screen version for obvious reasons (e.g. different header styles).
I know that you can use Media Queries in CSS so that different styles are applied for printing, screen, tv etc. But how do I supply a different set of CSS styles to the <cfdocument> tag so that it renders correctly?
My initial solution was to apply a class to the containing div of the <cfdocument> tag called .pdf and then write new styles for the content based on that class inside my main CSS file. So for example a style would be .pdf h1 {font-size:20px;}. The CFML would look like this:
<cfdocument type="pdf">
<link href="/css/mainStyleSheet.css" rel="stylesheet" type="text/css">
<div class="pdf">
<h1>Document Title</h1>
... {document body here} ...
</div>
</cfdocument>
Is there a better way to do this at all? Is there anyway to pass a different stylesheet just for PDF rendering? Can it be done with Media Queries perhaps?
How are you generating the PDF, via a parameter in the querystring? Something like index.cfm?page=foo&format=pdf? If you aren't, you could easily add a parameter like that, then in your CFM:
<link href="/css/mainStyleSheet.css" rel="stylesheet" type="text/css">
<cfif structKeyExists(url, "format") AND url.format EQ "pdf">
<link href="/css/pdfStyleSheet.css" rel="stylesheet" type="text/css">
</cfif>
pdfStyleSheet.css would contain only the CSS overrides for the PDF.

Resources