This question already has answers here:
Text Padding in Select Boxes
(7 answers)
Closed 6 years ago.
I have a few input fields in a form. I gave them all a padding of 5px but the select boxes seemingly have an additional space inside. It's not caused by padding, margin or text-indent. Text alignment is left. Is there a way to get rid of this?
Here follows my code. At the bottom is a link to the fiddle.
CSS
input[type=text],
select {
padding:5px;
}
select {
border:solid 1px #555;
padding:5px;
}
HTML
<div>
<select>
<option>Test1</option>
<option>Test2</option>
<option>Test3</option>
<option>Test4</option>
</select>
</div>
<div>
<input type="text" value="Test" />
</div>
https://jsfiddle.net/64ppa5f5/
PS:
I also shecked the zoom and it's 100%.
It has something todo with the browser rendering itself. See this answer on same question for more informations: Text Padding in Select Boxes
In summary, you should not do this or not common.
The padding you are seeing is coming from the browser specific stylesheet. To remove space in select box, add the following style.
input[type=text],
select {
padding:5px;
}
select {
-webkit-appearance: none;
-moz-appearance : none;
border:solid 1px #555;
border-radius:3px;
padding:5px;
}
Refer this link
Related
I have already visited this:How to increase the gap between text and underlining in CSS but my approach uses tags. The OP in the above question uses a css text-decoration:underline the approaches provided there are different
I have a heading which is underlined in my webpage.
<h1><u>Hello</u></h1>
But the gap between the text and the underline is small so I tried this:
u
{
padding-top:10px;
}
and this:
u
{
margin-top:10px;
}
But the gap between the text and the underline is still the same. Any idea how I can increase the gap?
Try this solution:
u {
padding-bottom:10px;
text-decoration:none;
border-bottom:3px solid #000;
}
<h1><u>Hello</u></h1>
The problem of your way of finding the solution is that the u element is using text-decoration for the bottom border. This border can not be moved because it is on the text. The solution is to remove the text-decoration for this and add a own border at bottom. Now you can increase the space between the content of h1 and the border with padding-bottom.
If you want to use the u element on other elements normaly you have to write h1 u on your CSS.
The <u> tag has been deprecated in HTML 4 and XHTML 1, but it has been re-introduced in HTML5 with other semantics.
If you want to underline the text, you could create a wrap element like this:
<h1><span class="underline"><span>Hello</span></span></h1>
span.underline{
padding-bottom:3px;
border-bottom:3px solid black;
}
You could increase the gap between the text and the underline by changing the padding-bottom
<h1><a>Hello</a></h1>
a
{
vertical-align: top;
border-bottom-width: 2px;
border-bottom-style: solid;
text-decoration: none;
padding-bottom: 2px; //You can adjust the distance here.
}
http://jsfiddle.net/74vn0shc/
This question already has answers here:
How can I remove the outline around hyperlinks images?
(18 answers)
Closed 8 years ago.
I have this simple logout button on the right (blue coloured) button and whenever I press the logout button, that border appears
I have tried the following CSS styles:
a:active
{
border-style: none;
border: 0px;
}
and these have been tried on all <a> tag possibilities like hover, active..
Any idea what might be the cause?
this is the Jsfiddle link
http://jsfiddle.net/v1x29f9h/
It's not a border, it's the outline.
#logoutButton {
outline: none;
}
Demo http://jsfiddle.net/v1x29f9h/1/
It is outline: none;. The border would follow the border-radius path.
This question already has answers here:
Simple CSS button with a rectangle beneath
(4 answers)
Closed 9 years ago.
I'm trying to create a CSS based 'button' like this:
The blue is just a background, so it's only about the text "Welkom" and the rectangle displayed below.
Whenever it's active or hovered over it should display a rectangle BELOW the button.
HTML: (This is the button)
<li>Welkom</li>
If the below is your HTML:
<li>Welkom</li>
Then you can do this:
li:hover,li:active{
border-bottom:3px solid blue; /*change blue to the color you want*/
}
See this demo
Fiddle in response to comment: Fiddle 2
The above uses box-align property(http://www.w3schools.com/cssref/css3_pr_box-align.asp) to center the bottom border(without requiring adjustment) but it will not work in IE9 and below
Fiddle 3 : Will work in all browsers but you will have to adjust the bottom at the center using relative positioning for both li and a tag within it.
you can do that on :hover with a border-bottom:
But you may and a border already without the hover so avoid jumping.
a {
border-bottom: 5px solid transparent;
}
a:hover {
border-color: blue
}
The code above is not all you may need.
-Sven
EDIT: as you see the other answer, U ay do that on the list element directly.
simple just follow below code:
HTML:
<div class="link">Welkom</div>
CSS:
.link { background-color:#379AE6; width:100%; padding:8px; padding-bottom:16px; }
.link a{ font-family:arial; text-decoration:none; color:#fff;
}
.link a:hover{ border-bottom:8px solid #6BBBF8; padding-bottom:8px;
}
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
CSS : change color of hr tag
how do you change the color of an hr tag? i looked it up and found this, but it didnt work..
hr{
color:#CCC;
background-color:#CCC;
}
Any ideas?
Style the border.
hr{
border: 1px solid #ccc;
}
Just change the border color. For instance, this HTML produces a red horizontal row.
<hr style="border: 1px solid #f00" />
try changing the color of it's border
probably the best way to add a custom style to show an horizontal rule in a crossbrowser way is to style instead a border-top of the following element (or the border-bottom of previous one)
Another solution is to style :after or :before psuedoelements of one of the <hr> adjacent/sibling elements
Try using this:
<hr noshade="noshade" />
as your hr tag, and then use the same CSS as you have already.
EDIT:
You can also add
border: 1px solid #CCC;
to your CSS.
This question already has answers here:
How to position the legend inside a fieldset with a border? [duplicate]
(10 answers)
Closed 9 years ago.
In a classical form, we have the legend tag on the same line of the top border like showed below.
The code is:
...
<fieldset>
<legend>Connexion</legend>
...
</fieldset>
Is it possible to move this legend lower in the formular like showed below?
Any idea what is the CSS ?
Thanks.
UPDATE
Below is the result after applying the following CSS:
fieldset {
position:relative;
}
legend {
top:20px;
position:absolute;
font-size:20px;
font-weight:bold
}
How to add more space after the legend 'Connexion' ?
You sure can do this with CSS. Without using absolute positioning you end up with a big gap in the fieldset border.
fieldset {
position:relative;
}
legend {
top:50px;
position:absolute;
font-size:20px;
font-weight:bold
}