Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I am saw in the documentation the mozilla y i wonder how workings the attribute: attr().
this is the docs that I seem : mozilla
OK I understand this code:
p::before {
content: attr(data-foo) " ";
}
<p data-foo="hello">world</p>
but my question is where could use attr() in css and what is diffrent between attr() from css and attr from javascript.
attr() used to manipulate attribute values.
In your code
<p data-foo="hello">world</p>
data-foo is an attribute
so
content: attr(data-foo) " ";
here attr(data-foo) is the value ie hello
so the output is hello world
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm using angular 9, have any ways to dynamic css of a class in component?
.stick-menu{
transform: translate(10px,20px);
}
I want dynamic poisition of x and y above, example to
.stick-menu{
transform: translate(20px,30px);
}
but not using ngclass or ngstyle, Just change in class and apply to all element
thanks
To element you want the css to be applied
[style.transform]="getTranform"
and in the component, you can specify getTranform function to return the translated location that you want by
get getTranform(){
return `translate(${this.val}px,${this.val}px)`;
}
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to take out text in a div, and replace it.
h2{content:none;}
h2:after{content:'CONTENT';}
I tried using text-indent, display:none, etc. Nothing is working. And no, I don't want to replace it with a picture. Please help, thanks.
You can try something like this:
HTML
<div id="bla">Hello world</div>
CSS
#bla:before {
content: "Goodbye planet";
position:absolute;
background-color:white;
}
Demo: http://jsfiddle.net/FHnks/1/
Note that content added via CSS is not a part of the DOM and will not be accessible via scripts.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am adding image using following css
{
background-image: url(../images/icon_new_reset.png);
background-repeat: no-repeat;
}
Then how to give alternate text or add text over background image.
if you use textarea you can't add text with css
but if you use div or ... you can add text using this:
<div class="testDiv"></div>
your style is like this:
.testDiv:after{
content: "your text";
}
by the way it's better use javascript or jquery for changing value or text.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Created a div with a unique class applied to it in the file bootstrap unique styles, but when the page loads, they disappear. How to understand that their erasure and fix it?
.slider-container {
height: 100%;
position: absolute;
z-index: -11;
}
My site is - http://tourlly.com/new/
http://i.imgur.com/MvkTHzT.png
in your CSS. Check it. And try use validator for markup
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How can I set the top position of a div 30*n. N is the number of div inside the outer div (And all that without javascript). For exemple.
#div1
{
top:#div1>numberOf(div)*30+"px";
}
You can't perform any calculations within CSS. The closest thing to what you want is to use PHP to edit inline CSS.
For example:
<?php $answer = result of calculation ?>
<div id="div1" style="top: <?php echo $answer; ?px">...</div>
I can't think of anyway of getting the answer without using javascript.