Z
Z
zelsky2015-10-14 17:34:22
css
zelsky, 2015-10-14 17:34:22

Change inside html and not css?

There is a code for the header on the page.
So, how to change it inside the page itself but without the style tag like in the code below? Could this be possible at all?
I want to use in django to generate posts from the admin panel with different images for posts.

header {
    position: relative;
    width: 100%;
    min-height: auto;
    text-align: center;
    color: #fff;
    background-image: url(../img/header.jpg);
    background-position: center;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    background-size: cover;
    -o-background-size: cover;
}

<style type="text/css">
    header
    {
      background-image: url(img/header.jpg);
    }
  </style>
    </head>

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Dmitry Novikov, 2015-10-14
@zelsky

Have you tried inline styles?
<header style="background-image: url(img/header.jpg);">...</header>

S
Sergey Goryachev, 2015-10-14
@webirus

-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;

I'm not mistaken, the background size works great without prefixes.
Not on the question, but also useful)

D
Denis Ineshin, 2015-10-14
@IonDen

You can do this on a specific element on any of the pages. Like this:

...
</head>
<body>
    <header style='background-image: url(img/header.jpg);'>
        контент
    </header>
    ...

0
0leg5ergeev, 2015-10-14
@0leg5ergeev

ah, I'm not the only one who knows about inline styles :(
and it's probably even better this way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question