Home > Mobile >  Can I use class attribute with same value in many posts of blogger?
Can I use class attribute with same value in many posts of blogger?

Time:10-30

Can I use class attribute with same value in many posts of blogger.

Example like:

In Blogger post 1

<div class="panel-heading body-1">some content</div>
<div class="panel-heading body-2">some content</div>
<div class="panel-heading body-3">some content</div>
<div class="panel-heading body-4">some content</div>

In Blogger post 2

<div class="panel-heading body-1">some content</div>
<div class="panel-heading body-2">some content</div>
<div class="panel-heading body-3">some content</div>
<div class="panel-heading body-4">some content</div>

In Blogger post 3

<div class="panel-heading body-1">some content</div>
<div class="panel-heading body-2">some content</div>
<div class="panel-heading body-3">some content</div>
<div class="panel-heading body-4">some content</div>

And

In Blogger post 6000

<div class="panel-heading body-1">some content</div>
<div class="panel-heading body-2">some content</div>
<div class="panel-heading body-3">some content</div>
<div class="panel-heading body-4">some content</div>

In above code, panel-heading is a value of bootstrap 3 and body-1 to body-4 is value of my css which is given in below.

CSS in template not in posts of blogger

<style>
.body-1 {background-color: red;}
.body-2 {background-color: yellow;}
.body-3 {background-color: blue;}
.body-4 {background-color: orange;}
 </style>

I want to change my css of value of body-1 to body-4 in my blogger template. Because I don't want to manage 6000 posts of background-color, and other things.

CodePudding user response:

This is as clear as I can be with the given information, but if the elements are all inside the same document, there shouldn't be a problem. If you are embedding it as a link rel="stylesheet" src="https://www.example.com/path/style.css" it will affect all elements with that class.

It would help if you could explain what you mean by 'blogger' and 'blogger template' so I can improve my answer.

CodePudding user response:

Yes, classes can be used multiple times. In your example, you can generalize classes like

.bgRed {background-color: red;}
.bgYellow {background-color: yellow;}
.bgBlue {background-color: blue;}
.bgOrange {background-color: orange;}

And it can be applied to any post as you like. See Class selectors for additional reference.

  • Related