简体   繁体   中英

How to Add Full Width Background Image in Joomla 3x

I want to add a full width background image for a div in an article in Joomla 3x, but I have no idea how. The article or modules can add the suffix class but only applied for the article's or module's div, still not full width.

code example:

<div class="container">
    <div class="article-wrapper">article here</div>
</div>

The suffix class I can add is to article-wrapper only, but I need to add into container .

Anyone help?

All you really need to do is add a custom CSS file specifying a suitable selector and background image like this or similar:

#content { 
  background: url(background-image.jpg) no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

The selector will depend on the template so you'll need to do some digging with FireBug or Developer Tools or similar.

The code below should work. But this .container div should be full width too.

.container { 
    background: url(background-image.jpg) no-repeat center center fixed; 
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

If you have more then one .container divs on that page then you will have to use the child selector. ie

#maincontainer .container:firstchild {
    //code here//
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM