Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Multiple backgrounds (only want certain ones repeating)

New Here ,
Apr 28, 2020 Apr 28, 2020

Hello ,
Can anyone send a line or two to please help me with this? Using an older version of Dreamweaver, I have apage where I have a main background, and others throughout the page. I have tried the common "background-repeat: no-repeat" html code, CSS ideas, and other things, but nothing works.

It seems that the way in which the code is written, when the main background image is set to repeat, makes all the others repeat. Is the problem there then - should I change that code in the beginning part of the body code?

Thank you kindly in advance. Hope everyone is safe and healthy!

1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 28, 2020 Apr 28, 2020

Not certain what you are trying to do?

 

If it is having different background images for various sections, then you should attatch a background image to each section.

e.g.

article {

backround-image: xyz.png;

}

p {

background-image: xxy.png;

}

 

If it is multiple background images for the same section, (e.g the body) then you use multiple background-images, seperated by commas, and the other properties should also be comma seperated.

 

See - 

/Using_multiple_backgrounds 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 28, 2020 Apr 28, 2020
Thank you for the response. Specifically, I have a main background (for the entire page), and others used within tables and layers. The main one and two others, I would like to have repeating, and the others non-repeating.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 28, 2020 Apr 28, 2020

Simple. Use the background repeat and no-repeat properties.  See screenshot and code below.

 

image.png

 

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Background Repeat / No-repeat</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
background:#fff url(https://placeimg.com/100/200/people) top center repeat;
}
div {
width:45%;
margin: 0 auto;
padding:3%;
color:#FFF;
background:#333 url(https://placeimg.com/400/200/arch) center center no-repeat;
}
</style>
</head>
<body>
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quas ea non recusandae, facilis. Sunt debitis expedita minus sapiente animi omnis odio quod nostrum. Nisi ipsum, accusantium expedita alias. Assumenda, aliquam.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quas ea non recusandae, facilis. Sunt debitis expedita minus sapiente animi omnis odio quod nostrum. Nisi ipsum, accusantium expedita alias. Assumenda, aliquam.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quas ea non recusandae, facilis. Sunt debitis expedita minus sapiente animi omnis odio quod nostrum. Nisi ipsum, accusantium expedita alias. Assumenda, aliquam.</p>
</div>
</body>
</html>

 

Post back if you have any questions.

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 29, 2020 Apr 29, 2020

Thank you kindly for your help! I figured it out my noticing where to place the mentioned "no repeat" code, after related the background jpg code:

background="images/all images/background 3.jpg" style="background-repeat:no-repeat;">

Cheers!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 30, 2020 Apr 30, 2020
LATEST

This is invalid code.

background="images/all images/background 3.jpg"

 

Validate your code often and fix reported errors.

Window > Results > Validation.

 

Or go directly to the W3C's online validation service.

https://validator.w3.org/

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines