score:0
if you want to include css in your html, you need to put them in your public folder instead of src folder and use '%public_url%' as the path to your css. so it would look something like this:
<link href="%public_url%/homepage.css" rel="stylesheet" />
but, it is highly recommended that you do import the css that you want inside your react component, because your css would get minified and bundled. so you could do something like:
import react, { component } from 'react';
// ... rest of imports
import './path/to/css/homepage.css'
for more info on this, go to the documentation here.
score:1
the problem is likely with the location of your files and the way in which you're referencing them. for example, is my_resume.pdf
in the same folder as index.html
? is homepage.css
also in the same folder?
the prefix /
is relative to the root directory.
the prefix ./
is relative to the working directory.
the prefix ../
is relative to the parent directory.
for further information regarding relative and absolute urls, i recommend checking out coffee cup's article on the topic.
hope this helps!
score:1
cameron payton ! can you using relative paths for it. instead you use absolute paths. example: http://your-domain/homepage.css and http://your-domain/views/icons/resume_logo.png
i think it will help you. please get back to me. thanks !
score:3
in your html file all you need to do is a normal link statement
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/journal/bootstrap.min.css" rel="stylesheet" integrity="sha384-1l94safxwavew88rkprz8r28eqmvt7kg9ux3ddcqya/p3cflntgqzmnyaua49pl2" crossorigin="anonymous" />
like so that one is from a website but you can do the same thing with a local one like
<link src="/styles/maincss.css" rel="stylesheet" />
that will work
Source: stackoverflow.com
Related Query
- How can I properly include a css file in my index.html file in React?
- How can I render HTML from another file in a React component?
- How to apply CSS style to HTML file that is inside the public folder of React JS
- how to import css file in react when generating static html and inject imported css into html head tag?
- How can I include a global JS file to my React project using webpack?
- How can I use the css file from react-table in my react project along with css modules?
- How can i include standard html in React .jsx file?
- How to import a CSS file in a React Component
- How do you center a div element in react w/out external css file
- How can I parse through local JSON file in React js?
- How can one extend React types to support html attributes as props?
- using css modules, how can I import classes from a file
- using css modules in react how can I pass a className as a prop to a component
- How can I properly import a Component into my Navigator in React Native?
- how to import HTML file into React component and use it as a component?
- How can I get data from a local file into my React app?
- How can I opt for React Styled-Components to generate a physical CSS file?
- How to properly import React JSX from separate file in Typescript 1.6
- How can I convert React Element to Html element?
- How can I pass CSS classes to React children and ensure they will override the child’s local class?
- How can I test css properties for a React component using react-testing-library?
- How to import a css file in a react component as raw text?
- how to test a react hook that can have a ref of an html element passed to it
- React how to connect JS file with HTML file
- How can I get a width of html element in React JS?
- How to import CSS file on Isomorphic React - Webpack
- Can you import an external CSS file in a React js file?
- How can I upload file from React to Express server?
- How can I access a local JSON file with Redux to use throughout my React app?
- With React Router, how can I assign a class to the HTML element?
More Query from same tag
- How to switch back to the default locale in Next.js?
- Array not resetting after changing query text
- How to pass props via Link in React (this.props.location is undefined)
- Loop and render an object in React.js
- How to stop TypeScript error 'Type A has no properties in common with Type B' when Type B "extends" Type A in some way
- Set maximum time for a function
- Trouble using a React component from an older version of React in v16.x
- Should component in React be aware of the structure of the data object get from the Store
- React and ApolloClient: Network error: forward(...).subscribe is not a function
- Cypress Test Fails: Getting "This DOM element likely became detached somewhere between the previous and current command"
- Any alternatives to "e" in event handlers in React?
- How to sign a cookie on a rails API based on a parameter sent by a react front end app?
- How to access google.maps.Map object with react-google-maps
- React Array of Objects useState from Fetch call assignment
- why toUpperCase not working in nextjs while adding slug
- Pass function by props in react router
- Material UI override styles with increased specificity
- How can we add label to react phone input 2
- How to get data from object and put the this data in a linechart component
- Get the event.target in formik Select onChange - ReactJS
- React JS Router changes props of element
- React: Assigning array to variable using useState to pass into modal
- Simple React-Redux component not updating
- Clear input text after click event
- Call a method within a React Component from Electron's globalShortcut
- How can I add hyperlink to table head column entries in react using material ui table?
- Difference between binding a method and not
- How to add additional information when the url changes but not replacing the entire page in Next.js
- SVG convert <g> tag to an <image> tag containing base64 PNG URI (read more)
- How to separate React router and nodejs api