Okay this is what I have.
BODY
{
font-family: sans-serif;
background-image: url(http://www.thexboxcloud.com/images/xboxbackground2.jpg);
background-repeat: no-repeat;
background-attachment: fixed;
background-position: left top;
position: absolute;
margin: 0;
margin-right: 15in;
}
P
{
position: relative;
padding: 1em 1em 1 em 3em;
left: 150px;
top: auto;
border-left: purple .25cm solid;
border-top: purple 1px solid;
border-bottom: purple 1px solid;
}
P.pillow
{
position: absolute;
margin-right: 15in;
}
Everything works fine until I try to set a class for "pillow". I am typing it in right but it seems that one of the upper 2 overrides it.
This is what I put to apply the class:
<p class="pillow">
Now that should work.
I'm trying to make a youtube video and paypal button for "pillow" not have a border around it at all.
But when I type it in, it does not override the first p class. Also, it makes the text margin spread out to the whole page when I make the first p class a specific class as well.
Could doctype code have anything to do with it? I'm using "loose".
But I can't figure out what I can't get a specific class to work. Any help is appreciated. Thanks.
The code does not try to remove the border in any way now. You seem to expect that a rule for P.pillow would prevent a rule for P from taking effect on a P element in class pillow. That’s not how CSS works. All rules with selectors that match an element are relevant when an element is being rendered, and if there are conflicting settings, they are resolved according to CSS cascade rules.
A simple way to prevent the border in this case is to add
P.pillow { border: none }
Just do this
.pillow {
position: absolute;
margin-right: 15in;
}
What you're trying to do in your code above is select any p elements inside your class .pillow which would read
.pillow p{
position:absolute;
margin-right:15in
}
But since you're applying the class right onto the p you don't need to define what element it is in your css. Hope this helps
Related
I try to remove padding between two span elements which is not working, i did padding and margin set to 0px but didn't work
span {
padding: 0px;
margin: 0px;
}
somehow div container occupies some default padding which creates problem, someone can help to solve this issue
http://jsfiddle.net/f30boLhu/
here i want to remove black marked space between two texts
you can play with line-height or add a height to .bonus
.bonus {
font-size: 1.4em;
display: block;
height: 20px;
}
Try to add some style with existing code for your second span whose having promise class, See below CSS code -
Or try this JSFiddle
CSS Code-
.promise {
position: relative;
top: -10px;
}
Try to put span tags together like:
<span>one</span><span>two</span>
Without any separate between them
Issue is pretty straight-forward. My CSS is being completely ignored, but I don't know why. The .Home .lander part works fine, except the border doesn't show up. The bigger problem is the box I'm trying to make under it. No CSS I'm typing for the box is working. Again, all I want to do is make a box. I followed the tutorial here: https://www.w3schools.com/css/css_boxmodel.asp but so far absolutely none of this is working for me.
The .js file:
import React from "react";
import "./Home.css";
export default function Home() {
return (
<div className="Home">
<div className="lander">
<h1>Remind</h1>
<p>A simple fitness tracker app</p>
</div>
<div className="box">
Countdown Timer
</div>
</div>
);
}
The CSS file:
.Home .lander {
padding: 80px 0;
text-align: center;
border: 5px grey;
}
.Home .lander h1 {
font-family: "Open Sans", sans-serif;
font-weight: 600;
}
.Home .lander p {
color: #999;
}
.Home .box {
height: 20%;
width: 20%;
border: 5px rgb(129, 56, 56);
margin: 10px;
box-sizing: border-box;
}
I did some reading on CSS specificity, so I tried changing from className to id. Nothing. I tried all pixels (for consistency?). Nothing. I even tried manipulating the CSS that otherwise works, like the .Home .lander, but the border won't show up. What am I missing? Why can't I make a box?! Four sides. Enclosing text. Really, really simple stuff here, but I'm getting absolutely nowhere.
Firstly, your border definition is incorrect. When using shorthand css you need to make sure you define everything. So you would do
border: 5px solid grey;
You're doing the same thing with the box. The border property needs to know what type of border you want: solid, dotted, dashed, whatever. So change the border attribute to the following:
border: 5px solid rgb(129, 56, 56)
Lastly, using percentages for width and height only works if you've defined the element's parent width as well. So you'll need to do the following:
.Home { width: 100% }
I have an annoying issue with the html layout of a form. I cannot really change the general setup, since it is part of a huge framework. But I have to "move" a button to a more suitable location. I am close, but not happy with the solution so far. Maybe you can give me some idea in this. Here is a dramatically simplified version to demonstrate my approach:
I have two container divs, top and bottom.
The top container shows a button on the left side. That button is fixed, but can have a different width due to the translation of its label.
The bottom container holds lots of stuff. Amongst that a second button at its top which works fine, but looks wrong. I want to optically move it into the top container, since there is a logical connection to the button in there. Sure, really placing it in there would be the correct solution, but I currently cannot do that. Instead I use a fixed position which works fine, except for the horizontal placement. I have to decide how far pushed from the left to place the button, so that it certainly does not overlap the first button in the container. I obviously have to consider all translations, the result works, but depending on the first buttons label I have an annoying horizontal gap between the two buttons.
I tried to use a pseudo element (::before) on the second button to help with the layout. Since when rendering the view I obviously have the translated label of the first button I can copy that into some property of the second button and use that property in my css to fill a before pseudo element of the second button which has exactly the same length as the first button. That is what is shown in the code example posted below.
What I completely fail to do is to place that pseudo element such that is it left in the top container (so exactly below the first button). The idea is to indirectly place the second button that way. Looks like this is not possible, obviously. But since I am a bloody beginner in markup and styling I thought it might be worth asking here...
Below is some drastically stripped down code to demonstrate my approach.
I create a jsfiddle for you to play around with. Here is the code:
HTML:
<div id="top-container">
<button>multilingual button text</button>
</div>
<div id="bottom-container">
<h2>
Some title opening the bottom container
<span class="into-top-container">
<button id="place-me" reference-text="multilingual button text">button to be placed</button>
</span>
</h2>
<p>Some content</p>
<p>Some content</p>
<p>Some content</p>
</div>
CSS:
body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
div {
margin: 0;
padding: 5px;
}
button {
margin: 0;
padding: 5px;
white-space: nowrap;
}
div#top-container {
width: 100%;
border: 1px solid green;
}
div#bottom-container {
width: 100%;
border: 1px solid blue;
}
#place-me {
position: fixed;
top: 0;
left: 400px;
margin: 5px;
background: yellow;
}
#place-me::before {
z-index: 0;
/*visibility: hidden;*/
position: absolute;
content: attr(reference-text);
margin: 0 5px;
padding: 0;
background: gold;
right: 100%;
}
Notes:
that in the above code the second button is placed with left: 400px;. That is more or less what I want to change. But obviously left: 0 is not correct...
the visibility css rule for the pseudo element is currently commented out for demonstration purpose
keep in mind that the second button is *not* contained inside the top container, but actually logically below the title of the bottom container. The goal is to move it optically up into the top container which already is where close to what I want. Except for the horizontal alignment...
Upon request here is a screenshot:
It is taken from the fiddle I posted above. I added the red ellipse which shows what element pair I want to move and the left pointing arrow indicating where I want to move that too. I want to move it exactly that far, that the two tests "multilingual button text" are exactly placed on top of each other, but without specifying an explicit left placement obviously. That is why the pseudo element exists: as a dummy placeholder. I would then hide that pseudo element and have the second button placed exactly right of the first button, regardless of how long the translated text in there is.
So the final result should like like that:
OK, I invested some more time, since this issue popped up again after a regression in our code and I found, as often after allowing some time to pass, a logical and relatively clean solution:
I use the same stripped down code to for demonstration purposes.
The jsfiddle is based on the one provided in the question itself.
HTML: no real change, except for the reference-text having moved from button to container, for the why see below:
CSS:
* {
font-size: 12px;
font-weight: normal;
font-family: Arial;
}
body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
font-size: 12px;
font-weight: normal;
}
span,
div {
margin: 0;
padding: 5px;
}
button {
margin: 0;
padding: 5px;
white-space: nowrap;
}
div#top-container {
width: 100%;
border: 1px solid green;
}
div#bottom-container {
width: 100%;
border: 1px solid blue;
}
span.into-top-container {
position: fixed;
top: 0;
left: 0;
pointer-events: none;
border: 1px solid transparent;
}
span.into-top-container::before {
visibility: hidden;
content: attr(reference-text);
position: relative;
margin-right: 5px;
padding: 5px;
border: 2px solid;
background: gold;
}
#place-me {
background: yellow;
pointer-events: all;
}
The basic change in strategy: it is the container holding the button to be placed that has to be positioned in a fixed manner, not that button itself (so the <span class="into-top-container">)! That allows to use the pseudo before element, now also anchored to that container, not the button, to take the space as required without actually getting part of the button itself.
Since that container is now place over the original multilingual button that one is not clickable any more. That issue is fixed by a css pointer-events set to none for the container and set to all for the placed button again. That makes the container itself simply ignore all events (clicks) and have them passed to the original button beneath.
I had to make sure that the font used inside the pseudo element is style exactly like the original multilingual button. That actually makes sense, since the font styling defines the actual width used by that button, so the actual width used by the pseudo element should be defined in exactly the same manner. In the example above I forced that by simply setting all elements font style rules to some fixed values (the initial * {...} in the CSS code). That can obviously also be done right inside the css rules for the pseudo element itself. I chose the more simple and brute variant here to keep the code clean.
Site: http://stagingsite16.info/
Screenshot below:
Problem:
As you see on the screenshot, there is a gap at the bottom of the page. (I applied red background so that it can be seen immediately.)
I tried applying this code:
html {
margin: 0;
padding: 0;
overflow: hidden;
}
but still it doesn't solve my issue. Any help is really appreciated! :)
You have to place the div of the footer outside all the other divs , and then add:
div#builder-module-537dadf9ae69e-background-wrapper
{
background: #2c2c2c;
color: #fff !important;
padding-top: 0px;
margin-bottom: 0px;
}
you had this before:
div#builder-module-537dadf9ae69e-background-wrapper
{
background: #2c2c2c;
color: #fff !important;
padding-top: 20px;
}
But you have to move the div outside the other divs!!
I've used this in a user style sheet locally and it seems to fix the problem:
.builder-container-outer-wrapper {
margin-bottom: 0px;
}
div#builder-module-537dadf9ae69e-background-wrapper.builder-module-background-wrapper.builder-module-footer-background-wrapper.builder-module-6-background-wrapper.builder-module-footer-1-background-wrapper.builder-module-bottom-background-wrapper.builder-module-last-background-wrapper.builder-module-footer-last-background-wrapper.builder-module-after-widget-bar-background-wrapper.default-module-style-background-wrapper {
margin-bottom: 0px;
padding-bottom: 1.5em;
}
Another thing to consider: CSS applies the style which is most specific to the element. The html { ... } element is the one for the whole page (including the tag), so it will be the least specific rule for the element you want to apply your style to. It is likely that a more specific style (such as div.builder-container-outer-wrapper) is applying the margin somewhere else in your CSS, and you'll have to fix it there. (See http://css-tricks.com/specifics-on-css-specificity/ for an explanation of how the specificity rules are applied.)
Anyway, hope that helps.
.builder-container-outer-wrapper {
margin-bottom: 0;
width: 100%;
}
This is the container which has the margin-bottom.
Div containaer and p element overlapping another Div that contains an image that needs to respond to a :hover CSS event causing only a small portion of that Div container to be able to sense the mouse hovering over it.
How do I solve this?
z-index isnt effective for some reason either.
Try and hover your mouse over the image.
Here Is The JSFiddle.
As #colandus said adding the position: relative and the z-index to the img should indeed do the trick.
However, it seems to me like you are over complicating things a bit. Why the position relative on the p? that is the one that is causing the problem...
What you are trying to do is default behavior if you use some simpler html / css. Something like this:
the HTML with some div's removed:
<div class="insp">
<h3>Thomas Edison</h3>
<img src="http://www.placehold.it/250x150">
<p>Lorem Ipsum is s...</p>
</div>
and the css with the position: relative removed from the p:
.insp {
border: 2px solid black;
margin: 10px 0px;
padding:10px;
}
.insp h3 {
margin-top:0px;
background-color:#FFDE5C;
}
.insp img {
float:left;
border: 5px solid #FFDE5C;
height:150px;
margin: 0 20px 20px 0;
}
.insp img:hover {
border: 5px solid #ffffff;
}
.insp p {
margin: 40px 40px 40px 80px;
}
And as you can see (http://jsfiddle.net/7fvcD/4/), it looks exactly the same and there is no hover issue anymore.
Put image as position: relative, then z-index will work.
Add the following CSS:
.insp-image img {
position: relative;
z-index:1000;
}
http://jsfiddle.net/7fvcD/5/
Don't need to change your markup ;)
Try this approach: Put the <div> with the <img> inside the <p> tag and set some margin to the img div.
Updated JsFiddle