Hide #text in CSS [duplicate] - css

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

Related

Is it possible to combine CSS :host() with other pseudoelements? [duplicate]

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>

Remove an inline width style setting with CSS [duplicate]

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;">

How to make text inside a div multiline? [duplicate]

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.

Space at bottom of div containing image [duplicate]

This question already has answers here:
Image inside div has extra space below the image
(10 answers)
Closed 1 year ago.
For this fiddle, why is there a space at the bottom of div#imageDiv?
JSFiddle
<div>
<div>
<div>
<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/SIPI_Jelly_Beans_4.1.07.tiff/lossy-page1-256px-SIPI_Jelly_Beans_4.1.07.tiff.jpg" />
</div>
</div>
</div>
<div id="text"><div id="inner">text goes here</div></div>
html {
line-height: 1.5em;
}
#text {
background-color: grey;
margin-top:-7px;
}
​
​
Set your image to img { display: block; }. And please next time add your code here on SO to prevent link rot and lets us easily review your code here.
Give your image a bottom vertical alignment and the space goes away.
jsFiddle example
img {
vertical-align:bottom;
}
you could also margin-top property to achieve that
http://jsfiddle.net/meetravi/7Knyx/14/
P.S Its always great to avoid negative values in css if you are planning to support relatively old browsers

Background link (on ALL the background!) [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to make a whole 'div' clickable in html and css without javascript?
I've set up a 100% width/height div to stay on the background of the website, like so:
.background {
background-color:rgba(50,50,50,0.4);
width:100%;
height:100%;
position:absolute;
z-index:-1;
}
I'd like to have a link that would cover the WHOLE div, but if I code something like this, I'll have the link to appear only on the last part of the div (remember that this div has to stay in the background, with some divs above it), after the other divs, that stay above it.
<a href='/home'>
<div class='background'></div>
</a>
Are there any HTML/CSS solutions?
You cannot nest <div> tags inside <a> tags. However, you can make the <a> behave like a <div> by utilizing the CSS display:block property.
CSS
*, html, body {
width: 100%;
height: 100%;
}
.background {
display: block;
}
HTML
​
JS Fiddle

Resources