All Questions
93 questions
1
vote
1
answer
36
views
Need to remove this mystery padding in between background and border
Need help removing this mystery padding in between a border and its background. In the preview it looks fine, but it exports with that weird padding inside the frame.
Here's the code:
<div ...
0
votes
1
answer
20
views
Why does adding a border to a parent div change its size to contain the margin of its children but not when it doesn't have border? [duplicate]
.parent {
background-color: red;
width: 100px;
/* border: solid 5px black; */
}
.child {
margin-top: 50px;
width: 100px;
height: 100px;
background-color: green;
}
<html>
<...
0
votes
2
answers
30
views
Hi, I am not able to see the CSS effect on the web browse to HTML file using Visual code. I can run HTML file in chrome and can see login page
I created login page in HTML and run in chrome and able to see the result but when I apply CSS effect like margin, padding and color but not able to run it. Do you mind how to connect CSS effect in ...
0
votes
1
answer
2k
views
I am encountering an issue in my React PDF project where I am unable to visualize the bottom and right margins as well as the borders of my reactPDF
I'm trying to generate a PDF using the @react-pdf/renderer library in my React application. Everything seems to be working fine except for one issue: the right and bottom margins are not visible in ...
-1
votes
1
answer
788
views
Latex how to add space between table border and figure inside cell?
I prepared table with images, and I want the images to have space between the line and them inside the table.
How to do it in latex?
The code is here:
\begin{figure}
\centering
\begin{tabular}{|c|c|c|}...
0
votes
1
answer
51
views
Taking into account the border when placing items (justify & align)
Here's my code: https://play.tailwindcss.com/6e1ovq2LZC?layout=preview (set your browser's zoom to 500%)
this is how the input with the buttons look like
As you can see, the left border of the first ...
0
votes
0
answers
48
views
Newline between buttons adds space between them [duplicate]
I am trying to make a simple row of buttons that, when hovered, drops down stylistically.
Here is my HTML:
.yellow {
background-color: #fff444;
}
.blue {
background-color: #7d7dff;
}
....
0
votes
1
answer
27
views
Adding/Removing border causing issues with the block element [duplicate]
I am new to HTML and CSS. I have the following HTML code :
and the following CSS :
and the output goes like this :
When I remove the border from the main tag in CSS the whole output gets distorted....
0
votes
1
answer
612
views
Collapsing margin in grid?
I've added a margin to the grid boxes and want to have the same space between the outer margin and inner one. But it seems that you cant collapse margins in a grid so the outer border is half as thick ...
0
votes
1
answer
35
views
How to eliminate white space between divs
I'm working on a site for a school project and i'm having trouble cause a white space appears between my two divs.
I want to remove it but I don't know how to do it...
I will be glad if someone could ...
0
votes
1
answer
41
views
Extra space - where does it come from?
I was fiddling around with this example
https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_element_clientleft_clienttop
It looked like the top picture below, having a space between the top ...
1
vote
0
answers
24
views
Negative margin in CSS works for element only if container element has set border or padding [duplicate]
According to Mozilla docs:
https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/The_box_model#margin
a negative margin should works fine.
But example provided by Mozilla has border set ...
0
votes
0
answers
30
views
Borders and Inputs move when I try inserting an image
I'm really new to programming. Whenever I try inserting an image using it moves the border down and inputs down. I then have to move them back to match the text as shown in the picture below. I do ...
0
votes
1
answer
1k
views
'border' makes 'background-color' works different [duplicate]
This question seems not so significant as others but I'd like to understand how it works and why it works this way.
We have a very simple code pen here:
html, body {
margin: 0;
padding: 0;
}
....
0
votes
0
answers
19
views
image border and image itself is overflowing [duplicate]
<img src="https://i.ytimg.com/vi/Z4ls0-ZGnU4/maxresdefault.jpg" class="img" >
<link rel="stylesheet" href='C:\Users\eagle\demo-projects\tribute-page\style....
0
votes
0
answers
187
views
why <span> element is showing bottom padding & bottom border and top border & top padding is messed up? [duplicate]
i know that span element is an inline element, with display : inline ; property by default . if i apply any top or bottom margin, border or padding to it that won't work (unless applying display : ...
-1
votes
1
answer
61
views
Margin not implemented from parent element [duplicate]
I was playing with css:
<body >
<div style="background-color:lightblue;">
<div style= "margin-bottom : 40px;">This is some text in a div element</div>
</div>
<...
1
vote
1
answer
186
views
gridborder and -margin in Tkinter to big
I want to decrease the distance between the lines (3 and 4) in the photo. But both ipady and pady are 0 and the distance is still a lot (i want it smaller).
Code:
labeljdisk = Label(root, text="3\...
1
vote
4
answers
2k
views
CSS border width changing layout [duplicate]
I have an issue when I change border width from 1px to 0px.
That changes the layout of divs. The divs should be stacked step by step in the influence of margin, but when I set the border width as 0px, ...
0
votes
5
answers
245
views
When hovering over link, want to move link towards the left without moving the border
I am trying to figure out if there's a way to move a link when hovering over it without moving its border. I want my links to move left but I don't want the border that I put to go with it. Here is a ...
1
vote
1
answer
2k
views
Expand parent div based on child size + margin
At the moment, I have div2 inside div1 and both have the same size.
I would like to add borders/margins to div2 but not reduce the size of div2 and instead expand size of div1.
Any idea how to do so?
0
votes
1
answer
53
views
All margins and borders convert from px to %
I am building an online shop for a project.
I have made all the element sizes % to keep the website fluid. However, all my margins and borders are in px, so when the browser is resized or people ...
1
vote
1
answer
780
views
In CSS, margin and overflow not working
I am new to CSS. I am building a webpage that will have 3 columns - the left one for navigation, the middle one for page content and the right one for external links and notes. First when I went with ...
1
vote
0
answers
29
views
How does margin and border work together within an element? [duplicate]
My goal in this question is to understand how these properties really work since I get results different from what I was expecting. I found workarounds to my problem (like setting a very thin border) ...
20
votes
2
answers
53k
views
Is it possible to add border outside the margin using CSS?
I'm pretty sure someone has asked this question already, but I couldn't find it anywhere on Google or here. I'm just being curious here as to the limitations of CSS regarding this.
Is it possible to ...
1
vote
1
answer
42
views
How can a border cause margins to collapse?
Please take a look at the following examples:
.wrapper {
width: 740px;
background: #ccc;
}
.leftSidebar {
float: left;
width: 200px;
}
.mainContent {
padding-right: 200px;
...
1
vote
2
answers
315
views
HTML/CSS - Phantom Margin which I can not find
I'm creating a menu bar on my website. My issue is that there is a small margin at the side of one of my menu items. (I have highlighted this by adding background-color: black; to the container.) I am ...
0
votes
1
answer
53
views
Unexpected style effect on windows' border
The MainWindow in my project has a lot of controls that have borders so I created a style in Window.Resources that would apply to every border in the window. In it I set that margin to be 5 and ...
0
votes
1
answer
352
views
Extra padding on border
I am getting extra padding added on my bottom border on hover. Is there a way to get rid of the extra padding?
I have tried:
#nav a:hover, #nav a:focus {
border-bottom: solid 3px #000;
padding:...
0
votes
3
answers
550
views
Adding background picture inside margin
I am a beginner in making html. I am only in high school.
We were tasked to make a website and I wanted for it to look like the picture below. We were only allowed to use notepad to create it, ...
0
votes
1
answer
795
views
Margin on child and border on parent
I have box with a child div. The child has a margin. If I set a border on the parent (div.box) the height of the element changes as shown in the following image. Where is the trick?
.box {
...
0
votes
1
answer
32
views
How do I correctly implement rounded corners? Why is the way I'm using not working?
I am trying to impose a 20px rounded corner radius on the borders of this container. I need to do this without importing packages or anything like that. Here is the relevant code.
#container {
...
1
vote
1
answer
1k
views
BxSlider white space
I am new to html/css/javascript and am trying to add an image slider using BxSlider to my website. I am having an issue when the slider expands to a certain size it starts adding a white edge. Is this ...
0
votes
2
answers
2k
views
JavaFX remove padding/margin/border from Pane
I can't seem to remove the left and right border of this GridPane. See picture below.
Left and Right border
My FXML file is
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?&...
0
votes
1
answer
68
views
Border without margin to picture
If I border a img the border has a margin and the img gets a white padding.
How can I take the margin off the border?
I have it like this: border: 1px solid gray;
8
votes
1
answer
443
views
Why does a 1px border cancel out a 100px margin-top and kills a scrollbar?
This doesn't yet make sense to me. What am I missing?
The code is below and on Codepen.
* {
box-sizing: border-box;
margin: 0; padding: 0;
}
body {
height: 100vh;
background: ...
1
vote
2
answers
166
views
Why does the box come out like this (padding/border/margin)?
So this is my first day learning HTML&CSS and I'm currently having a problem. Why does this block come out like this (on left is what I get & on right is what I'm trying to achieve):
HTML:
...
0
votes
1
answer
70
views
HTML and css menu
CSS and HTML file for the menu.
@font-face {
font-family: 'Raleway';
src: url('Raleway-Light.ttf');
font-weight: normal;
font-style: normal;
}
body {
font-family: ...
-1
votes
4
answers
2k
views
Margin on body border in CSS?
While, trying to create a body border around the website, I am having troubles creating margin between the website and the border.
I want to have a margin of 20px around the border, but I can't seem ...
0
votes
2
answers
136
views
div with same margin top and bottom (no %)
all I want is to have a small black line on the left of the screen with borders top and bottom 30px.
It's pretty much this but if I use the % I won't have those 30 px on the top and bottom.
#border-...
2
votes
3
answers
43
views
How to create a border that does't add a margin?
I'm new to HTML/CSS, and I'm learning Bootstrap.
I'm coding a Bootstrap navbar and I have a small difficulty, here's a fiddle of the work I have done.
In the HTML code there is the normal markup ...
0
votes
2
answers
43
views
How to make my box model is well displayed?
I don't understand why the margin-top CSS property is not displayed in my divs with class .inner. Moreover I don't understand why the border of my first .inner div overflows his parent.
I thought ...
1
vote
0
answers
31
views
HTML/CSS table: how to make zero border for all the cells? [duplicate]
I would like to create an HTML table whose cells are filled with images (say this red square), and I do not want any padding/border/margin between cells.
My HTML is like below:
<table>
<...
-1
votes
2
answers
125
views
border margin-bottom not working CSS
I have a border which I am wrapping around the page using <div>. The parent element is the actual page. I can't seem to figure out why the margin-bottom is not working.
.page_border {
...
2
votes
1
answer
2k
views
Why is adding or removing a border changing the way margins work?
If I have a container with an element inside that has a margin, that elements margin will not push it down within that container but instead push down the container itself. That alone, while annoying, ...
0
votes
2
answers
119
views
Making tomb shape. How do I make it?
I want to put the text club members inside the following shape.
What I have been trying to do is to just give left and right margin and somehow make the above shape.
But I have no clue how can I get ...
0
votes
2
answers
609
views
Margin on JTable with 1px border
I have JTable inside a JScrollPane inside a JPanel inside a JFrame. Normally the table or the scroll pane have a grey 1px-thick border. To add margin, I learned to use EmptyBorder, but this overrides ...
0
votes
1
answer
298
views
Margin collapse causing a Div to move.
I am working on HTML and having an issue with what I think is margin collapse. When I take out the line "border:solid black 1px;" from the Div #body in my css, it causes the Div #header to drop about ...
1
vote
2
answers
85
views
a strange position issue when adding border for a div
html:
<div class="outside">
<div class="inside">
</div>
</div>
I have two CSS : #1 and #2
/*CSS#1 does not work*/
.outside{
background: blue;
...
13
votes
6
answers
27k
views
HTML CSS Box with padding and margin and 100% width? [duplicate]
I have a box #box with width: 100%, height: 100%, padding: 5px, margin: 5px; border: 5px;
I need in HTML5 layout correctly display that.
Now i have that:
But i need fit block in body area.
Code:
&...