A div area isn't behaving normally.
Here's the link
(all the styles are in theme.css files)
In the HTML file there is a <div> which starts on line 89 and ends on line 94, has two classes assigned to it, I cannot apply box-shadow property to it, I have set the display to block, set the background color to black to check if it displaying but for some wired reason it just does not display.
I could apply margin to the div (theme.css line 280).
Any help on how to display it normally (with the box-shadow) would be appreciated.
Thanks in Advance
You can't add the box-shadow property because the div.dropdown-toggle (the element in question) has not a height and a width.
Try putting (like a test) these CSS rules:
div.dropdown-toggle {
width: 100px;
height: 100px;
box-shadow: 1px 1px 2px #333;
}
You'll see the div with the shadow.
Cheers,
Leo
Related
I have an HTML page for my code and a CSS page for all my classes/styling, but my div class is not applying to my div code.
It's weird because all of my other div classes are fine, but it's just this one.
My code is simple:
<div class="box">
</div>
And my class is also fairly simple:
.box {
border-right: 10px solid black;
border-left: 10px solid black;
border-top: 10px solid black;
border-bottom: 10px solid black;
}
It is probably a simple rookie mistake as I am new to this, but as I said, all the other classes work fine and they are the same as this.
Also, I tried putting the class in the HTML file itself, in [style], and it worked perfectly. I just wanted to know why it wasn't working when it was in another file when everything else was.
You must specify the width and height of the div. Because of that, it isn't showing the borders. Or, you can put some content inside your div, and after that, it will show the borders.
And a little advice: you don't have to type style for all border sides especially. You can just say: border: 10px solid black; and it will be applied to all sides of the box.
You need to add some content to your div, or give a height to your div. If not, you will not be able to see your div and the border styles that you added.
In addition, you can make your code more efficient since all 4 border sides are the same styles. You can just use the following styling:
.box {
border: solid 10px black
}
So, after a bit more googling, I discovered it was as simple as doing shift + f5 to do a complete cache refresh. Turns out, if you have a completely separate file for all your CSS classes, it doesn't update the cache automatically.
Before flagging this as already asked, pls read the whole scenario. Thanks
SHORT VERSION :
Just to clearly state what i am trying to achieve, here's the page https://www.facebook.com/MercedesBenzPolska/ and I want to add border to the target element (on which i am hovering), whether it be <div> or <img> or <p>, without the shaking
DETAILED VERSION
Webpage in question: Any of Facebook's page.
Requirement: Moving a cursor over an element should add border to the target element [only on hover therefore temporary border not permanent]. Permanent border will be added ONLY if I click on that element. [Simply, if I hover over an element it will be highlighted with, say, pink border and only when i click on it, a green border would be added]
Initial problem: adding border on elements on hover would make the whole page's structure shaky, since I am constantly adding and removing the border. For that what I did was add a transparent 1 px border to all the elements of the page, and on hover just change the color of the border from transparent to pink; thus no shaky.
Present problem: The above solution was working for all the pages till I encountered Facebook's page. It turns out adding the initial 1 px border totally disrupts the structure i.e. the look and feel of the page. DIVs move from somewhere to somewhere else.
How do I now solve my original problem? Is there a way of, maybe like, applying a negative margin or border, so that adding the extra 1 px border does not dirupt the page's structure? I don't know I am just suggesting. Pls help
[SCREENSHOTS]
1. this is when the page loads [without applying the border]
2. Now when I hover over the div containing image ie adding 1 px border on hover, the divs move here and there
css I am using
* { border: 1px solid transparent !important;} //when page loads
.hover-selected{ border: 1px solid #e42a78 !important;} //on hover border
.option-selected:hover { border: 3px solid #529c56 !important;cursor: default;} //when option is selected
The images and the css both reflect towards the same problem, the default 1px transparent border disrupts the page's css and If I don't do that, the on hover border application becomes shaky and the page's css anyway gets disrupt
box-shadow: 0px 0px 0px 1px #000;
Use box shadow instead border. Box-shadow don't take up space.
div {
width:300px;
height:300px;
background: red;
}
div:hover {
box-shadow: 0px 0px 0px 1px #000 inset;
}
<div> Test </div>
outline is perfect for this. It works in a very similar way to border but does not effect layout at all.
div:hover {
outline: 1px solid orange;
}
<div>
Lorem ipsum sit amet.
</div>
<div>
<img src="https://placehold.it/200x100">
</div>
<div>
Lorem ipsum sit amet.
</div>
you can use box-sizing property in css. Try below code with and without box-sizing property
<div class="item">
</div>
.item {
box-sizing: border-box;
height: 50px;
width:50px;
background:red;
}
.item:hover{
border:1px solid black;
}
I would start from something like this and move from there:
*:hover:last-child:before {
display:block;
content:"";
position:absolute;
top:0;
bottom:0;
left:0;
right:0;
border:2px solid red !important;
}
Using a pseudo-element instead of putting a border on the actual object might not create as many issues with the initial layout. Still not exactly what you asked for, but I believe it's at least a bit closer. :-)
EDIT
I believe that the only way to achieve this as good as possible would be to be less greedy when selecting elements in the CSS, and specify a list like so:
a:hover:before,
img:hover:before{
display:block !important;
content:"" !important;
position:absolute !important;
top:0 !important;
bottom:0 !important;
left:0 !important;
right:0 !important;
border:2px solid red !important;
}
Good day! I apologize for my English.
the question is:
by task, a block is created in the center of the page with the elements.
1picture
all lements have a box-sizing: border-box;
at the cursor position above the elements - all elements get transparency, except for one cursor over it. this position is done.
2picture
At the beginning of the frame, the elements are specified in part:
.content>div:not(:last-child) {
border-bottom: 5px solid #fff;/*всем элементам кроме последнего нижняя рамка*/
}
.content>div:nth-child(2n):not(:nth-child(10)) {
border-right: 5px solid #fff;/*всем чётным кроме последнего рамка справа*/
}
.content>div:nth-child(2n-1):not(:nth-child(4n-1)) {
border-right: 5px solid #fff;/* выборка оставшихся элементов рамка справа*/
}
to avoid doubling the borderers. by task - a single boarder is displayed.
this is the form
3picture
Further. when you move the cursor over an element, the element gets opacity: 1; and the mapping of all four Borders.
since the borderers are partially installed, with .element: Hover {} add the missing border. Border - the top is installed without problems, to display a single board - set the margin - top: -5 pixels, while the element is stretched vetically without pulling the bottom element behind it. if you set a horizontal border, left or right,then the element is compressed and two boundaries are displayed, the neighboring element and the neighboring one. when you move 5 pixels to the left, the element does not stretch, and the moving element pulls after it.
picture4
The question: what parameters to set to an element that would show a single frame with four sides when hovering, and the element did not move.
All the code: https://github.com/evgenjnr/weather-forecast-test.git
Page of result task: https://evgenjnr.github.io/weather-forecast-test/
Using only HTML & CSS, inline-block, without float, flex-box.
Instead of borders you can use box-shadow: inset 0 0 0 2px white, 0 0 0 3px white; that way you don't have to handle each case individually.
https://codepen.io/anon/pen/LeeWqr
decided to install elements of the content box on all sides of the border at once, setting the width through calc (width - 5px) and margin - left -5px
now copy to GitHub
There is some weird white space showing up on the right side of my website in mobile. I was wondering if there is a CSS trick to add a border to all the html elements within the body of a webpage so that I can figure out which element is extending out and causing the white space on mobile.
Thank you
You can try this CSS snippet:
* { border: 1px solid black; }
Every element should now get a border. Beware, this means everything. Hopefuly it'll help you figure out that white space in your app!
Include that CSS snippet before your CSS files so that it can be overwritten - or after, to force it onto every element.
Try with
* {
outline: 1px solid red;
outline-offset: -1px;
}
* is a global selector, while outline will not mess with your elements positions, it'll just add a 1px red outline
Also make sure you use a CSS reset (usually body has by default 8px margin http://www.w3.org/TR/CSS21/sample.html)
You can resize your window, open the debug console and inspect the elements that might create the issue. Take a look at the Style panel and test-edit the styles until you get it fixed. in Chrome's Console you also have the Emulate option to test your page for different devices.
* {
border-style: 2px 3px solid dashed #3A5FCD;
}
I've had a similiar issue like this before and trying to finally get it corrected. If you notice in the js fiddle there seems to be a thicker border above the actions div and I'm trying to find out why there is and there isn't in the template that I purchased.
http://jsfiddle.net/pGFfa/
Template:http://kansasoutlawwrestling.com/files/templates/admin/peachv1.2/Template/forms.html
EDIT:
I updated my page with the real intended page but look at the actions area and there still is a border on the left and right. Not sure why.
The double border is because of the bottom border of the content div. The div in the template has rule ".box .content.with-actions" applied which says "border-bottom: 0 none;". The content div in your fiddle doesn't have that rule so it has a bottom border and also the actions div has a top border hence the thicker line appearance.
The difference is that the content div in the template also has the "with-actions" class while the one in your fiddle doesn't. Just add that class and the problem disappears.
Updated fiddle http://jsfiddle.net/7jrEp/2/
As a note, when your css is linked externally any changes you make to the actual css changes every fiddle we post. It's better to paste the css into fiddle so it doesn't break.
And the problem as noted above was a double border plus the radius being applied to the bottom and not the top of the form container.
In content.css, try changing:
.box .content-form { border: 1px solid #C8C8C8; }
to:
.box .content-form { border: 1px solid #C8C8C8; border-bottom: none; }