This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
wrapping the text inside div - css
Fiddle: http://jsfiddle.net/aTFK2/2/
HTML:
<div id="ChannelDescription">ThisIsAVeryLongTextWithoutAnySpacesLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmed</div>
CSS:
#ChannelDescription {
width:560px;
color:Gray;
white-space:normal;
font-size:14px;
}
NOTE: I cannot change the width to any other value. Neither can I use break points. I am looking for a pure CSS2 solution.
word-wrap: break-word; will solve the problem.
Related
This question already has answers here:
Can the CSS :part pseudo-selector be used to style nested web components?
(2 answers)
Closed 8 months ago.
I'm trying to define some style on the :before pseudo-element of a custom element host.
I've been trying variations around the sample below, but nothing seems to work and I can't find information about it. Is that possible at all? If so, what am I doing wrong?
:host(.open):before{
background: grey;
opacity:.4;
position: absolute;
left:0;
top:0;
width:100%;
height:100%;
}
Here's a fiddle to show the issue: https://jsfiddle.net/8uzjb7ew/ . The custom element should have greyish background, but the :before pseudoelement is not rendered.
I'm not sure about specific :host() pseudo element, but you can combine pseudo elements.
div:target{
background-color:orange;
}
div:before{
content:"*";
}
div:not(#D):target:before{
content:"Targeted, not DEF - ";
}
To ABD
To DEF
To GHI
<div id="A">ABC</div>
<div id="D">DEF</div>
<div id="G">GHI</div>
This question already has answers here:
Hide text in html which does not have any html tags [duplicate]
(3 answers)
Closed 2 years ago.
I'm trying to hide #text in CSS
Screenshot
Screenshot2
What kind of CSS should I write to hide this text?
Thank you in advance.
div{
height:100px;
width:100px;
margin:10px;
background:aqua;
}
.invis:hover{
visibility:hidden;
}
.display{
display:none;
}
<div class="invis"></div>
<div class="display"></div>
Depends, you have more options to hide something:
You have 1st:
visibility: hidden;
//or
opacity: 0;
2nd:
display: none;
Visibilty and opacity just make it invisble, but the box model is still acting in your html, so things have paddin margin and stuff.
Display none will actually dont display the element and will hide the element in the source code
This question already has answers here:
What does the ">" (greater-than sign) CSS selector mean?
(8 answers)
What does a space mean in a CSS selector? i.e. What is the difference between .classA.classB and .classA .classB? [duplicate]
(3 answers)
Closed 4 years ago.
I'm using a CMS(Joomla), and they allow me to put a class for a tag and then I can modify the css for just that particular page.
I'm trying to use MDN to find the answer but I couldn't exactly get it to work the way I wanted.
Here is the JSFiddle they had on their page, I was messing around with it:
https://jsfiddle.net/amvz5dkb/13/
<div class="divclass">
<span class="spanclass">Span #1, in the div.
<span="betterspanclass">Span #2, in the span that's in the div.</span>
<span="betterspanclass">Span #3, in the span 1.</span>
</span>
</div>
<span>Span #4, not in the div at all.</span>
And here is my CSS
.divclass > .betterspanclass {
background-color: red;
}
This doesn't work, only
.divclass > span {
background-color: red;
}
Seems to have an effect but it doesn't affect span 3 at all, only span 1 and span 2. I want to make the background red for every betterspanclass inside divclass. Is this possible?
This question already has answers here:
How can I remove CSS element style inline (without JavaScript)?
(6 answers)
Closed 6 years ago.
I have a div that looks like this:
<div class="wtHolder" style="width:41.66%; height:150px; position:relative;">
Is there something I can add in css for the wtHolder class that will remove width:41.66% of this?
(If you want the background of why I need to do this, see this question.)
yes you can use !important to overwrite it:
.wtHolder {
width: 100px !important;
}
It's a trick , but you can actually use !important
.wtHolder{
width:100% !important;
background-color:black
}
<div class="wtHolder" style="width:41.66%; height:150px; position:relative;">
This question already has answers here:
Is there a CSS parent selector?
(33 answers)
Closed 8 years ago.
Is this possible with css only? I have the following:
<div class="container">
<img src=#>
</div>
How do I get .container to have a box-shadow (and other styling) when and only when img is in the state :hover?
As people have stated there is no CSS parent selector, for a number of good reasons as stated in the linked duplicate question.
However, with the code you've shown, you can just apply the hover pseudo-selector to your parent element and it will achieve almost the exact same functionality.
So this:
div:hover{
border:1px solid red
}
Would work only because you have a single child, and would have the issue that if you hover adjacent to the img but not directly on it the parent will still have styles applied because its a block element.
You can convert it to inline-block to limit this, like so:
div{
display:inline-block;
}
div:hover{
border:1px solid red;
}
However, this will have implications for how other sibling elements to the parent flow.
You can use jQuery:
$("span").hover(
function () {
$(this).parent().addClass("add-class");
},
function () {
$(this).parent().removeClass("add-class");
}
);
Here is the demo http://jsfiddle.net/Sv6Av/
You can replace span with another tag such as img
Nope. No parent selector in css yet. You will have to resort to js for now. For more explanation read this