Help me!!!
I can't import background in html
do you know any tag that can import background

Dani AI

Generated

Short answer: use CSS, not an HTML "import" tag. was right that there is no HTML element that pulls in a background. pointed you toward CSS — here are a couple of modern patterns and practical checks that go beyond the simple example already shown in the thread.

/* solid fallback + responsive cover */
html, body { margin: 0; min-height: 100vh; }
body {
  background: #f5f5f5 url("/assets/bg-large.jpg") no-repeat center;
  background-size: cover;
}

/* layered gradient + image for better contrast */
body.hero {
  background:
    linear-gradient(rgba(0,0,0,0.35), rgba(0,0,0,0.35)),
    url("/images/hero.jpg") center/cover no-repeat;
}

Common troubleshooting checklist:

  • Confirm the image URL is reachable (open the URL directly in the browser; expect HTTP 200).
  • Remember paths are relative to the CSS file, not necessarily the HTML page; adjust with ../ when using an external stylesheet.
  • Watch case sensitivity on Linux servers and verify the filename and extension match exactly.
  • Use DevTools to confirm the stylesheet loads and to inspect computed styles — another rule may be overriding your background.
  • If the page has no height, the background may not be visible; min-height: 100vh or putting the background on html can help.
  • Clear the browser cache or do a hard reload after changing assets. Note that background-attachment: fixed is poorly supported on some mobile browsers.

For syntax details and advanced options (multiple backgrounds, gradients, size keywords), see MDN’s pages on the CSS background shorthand and background-size. Also avoid the obsolete HTML background attribute — prefer CSS for control and accessibility.

Recommended Answers

All 7 Replies

I have no idea what you're talking about. There is no HTML element that can import anything. Are you wanting a background image, color, etc? You simply aren't providing enough information.

Regards, Arkinder

you can use this code (css)

<style type="text/css">
body {background-image:url('BACKGROUNDHERE.FILETYPE');}
</style>

make sure you have the picture in the same file as the page.html or if you have a picture called pic.jpg in an images folder then the code should look something like this:

<style type="text/css">
body {background-image:url('images/pic.jpg');}
</style>

hope this helped

I think you have got the solution to your problem. Well I'm here to ask you about the new design of my website. I request to check out my website background and give me suggestions to make it more attractive and also let me know if its fine .
My website is "" please look for it in Google or go there directly .
Thanks

Hi michealcdz,

Requests for website reviews should be posted here.

It looks fine.


Regards, Arkinder

Thanks Arkinder for telling me the right place and viewing my site. :)

aa

background-color:red

you can change red to any colour you wish

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.