I am using below CSS for my button
.ui-button-text {
background-color:#3e9cbf !important;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #F0F8FF !important;
width: 50px;
}
Here if you will check ,i am using width: 50px; but i want the width of button shuold be flexible it should change width according to text size if button text is Submit then button width will small but if text is something like this Post Your Question now button width should change.
How can we achieve this with css ?
If you are using a div then you need to set it to display:inline-block then you do not need to set a width.
DEMO http://jsfiddle.net/kevinPHPkevin/kw3La/
.ui-button-text {
background-color:#3e9cbf !important;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #F0F8FF !important;
padding: 10px;
display:inline-block;
width: auto !important;
}
Do it like this: demo
CSS:
.ui-button-text {
background-color:#3e9cbf !important;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #F0F8FF !important;
padding:2px 6px;
}
html:
<button class="ui-button-text">Submit</button>
<button class="ui-button-text">Post your question</button>
However if you're talking about overriding the css that is coming from .ui-button-text, then do as here : http://jsfiddle.net/bcqPG/1/
CSS:
.ui-button-text {
background-color:#3e9cbf !important;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #F0F8FF !important;
width:50px;
}
button.ui-button-text{
width:auto;
padding:2px 6px;
}
Related
Can someone suggest or help with the border on full calendar V5.3. Border is incomplete on both the top and left. CSS worked in V4, can't see where/if this changed in V5.
#calendar {
max-width: 600px;
max-height: auto;
margin: 60px auto;
font-family: "Lucida Grande", Helvetica, Arial, Verdana, sans-serif;
font-size: 11px;
}
.fc td,
.fc th {
border: 1px solid darkgreen;
}
thanks
Jsfiddle
I set font-size: 12px on my body element. But on the mobile device some elements have a font-size of more than 12px (for example, element p). Why does this happen? How can this be fixed?
body {
font: normal normal 400 12px/1.5 "Droid Sans", Helvetica, "Helvetica Neue", Arial, sans-serif;
}
.footer {
background: #1d3057;
padding: 15px 30px;
color: #dedede;
width: 100%;
box-sizing: border-box;
}
. footer span {
display: inline-block;
white-space: pre;
float: left;
font-size: 12px;
}
You can use this solution:
* { max-height: 999999px; }
I have a problem with a span element in IE (currently tested against IE9 and IE10). When I open F12 Developer Tools and select that span element I can't find it on screen. However, if I manually assign a background-color other than transparent or inherit it is shown at its expected place.
The problem is, that the span element is used as alignment element for a popup, but since the element is missing, the popup is incorrectly aligned.
I wasn't able to observe that behavior in jsfiddle, yet. And also can't test it in other browsers.
Here is how the significant markup looks like:
<div id="div1">
<div id="div2">
<span>
<input id="in" value="Somename"></input>
<label for="in">Person surname:</label>
</span>
</div>
</div>
And the corresponding CSS like shown in the developer tools (except for the background-color attributes):
#div1 {
background-color: grey;
cursor: auto;
font-family: Thoma, Verdana, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
text-align: left;
color: #000000;
bottom: 0px;
height: auto;
left: 0px;
position: absolute;
right: 0px;
top: 0px;
width: auto;
}
#div2 {
background-color: blue;
cursor: auto;
font-family: Thoma, Verdana, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
text-align: left;
color: #000000;
}
span {
/* background-color: red; */
font-family: Thoma, Verdana, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
text-align: left;
color: #000000;
margin-left: 0px;
margin-right: 0px;
box-sizing: border-box;
width: 100%;
}
input {
/*background-color: transparent;*/
color: #000000;
padding: 1px 2px 1px 3px;
font-family: Thoma, Verdana, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
margin: 1px;
border: 1px solid #b9b9b4;
overflow-x: hidden;
overflow-y: auto;
width: 90%;
}
label {
cursor: auto;
font-family: Thoma, Verdana, Helvetica, sans-serif;
font-weight: normal;
text-align: left;
color: #000000;
left: 0px;
top: -99999px;
font-size: 0px;
position: absolute;
}
Any ideas, why the span tag could be missing?
Maybe I should clarify, I'am not so much interested in a solution (since I already found one), but in an explanation why I observe this different behavior. Both for IE vs Jsfiddle and with vs without background-color.
I am not responsible for the HTML markup, and can't change that. I have only limited access to change the CSS.
Either use display:block or float:left
Tested on IE9-10
Also note that: use div instead, span tag is not designed to use like this and not a problem to create another #div3 unless you have something specific.
span {
background-color: red;
display:block; /* float:left; */
font-family: Thoma, Verdana, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
text-align: left;
color: #000000;
margin-left: 0px;
margin-right: 0px;
box-sizing: border-box;
width: 100%;
}
Add "display: block;" to the span element css.
The span element default display property is inline and with this you can't set width, height, margin or padding properties. So the span element is not missing but have a 0px width and the height of the line-height of font property.
Regards!
Definition and Usage
The <span> tag is used to group inline-elements in a document.
The <span> tag provides no visual change by itself.
The <span> tag provides a way to add a hook to a part of a text or a part of a document.
more about span
I am trying to use a background image and/or color behind my menu items. Using either the image or just a background color the background will only match the height of the text. The height of the background needs to be 30px and the text needs to 16px and centered - like a normal button. I've tried every combination of css I can think of but can not get the results I'm looking for.
#menu-container {
/*float: left;*/
width: 960px;
margin:50px auto 0 auto;
height:50px;
}
#menu ul {
text-align: left;
height:50px;
}
#menu ul li {
display: inline;
background-image: url(images/menubutton.png);
background-repeat: no-repeat;
}
#menu ul li a {
text-transform: uppercase;
padding-right: 13px;
padding-left: 13px;
font-size: 16px;
/*line-height: 0.2em;*/
color: #000;
font-style: normal;
letter-spacing: 1px;
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue",
Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 400;
}
#menu ul li a:hover {
color: #ff0000;
text-decoration: none
}
Here is the code you need:
#menu ul li {
display: inline-block;
background-color: #a0a0a0; /* I changed this for testing */
background-repeat: no-repeat;
padding-top: 7px;
padding-bottom: 7px;
}
Basically, it used to be display: inline which prevented you from being able to adjust the height. You also can't use display: block because then they will not all be on the same line. So, display: inline-block is exactly what you need.
Then I added padding-top and padding-bottom with 7px each to keep the text in the middle.
Here is a working DEMO
Hope this helped.
The image slider menu items are shifted downward 5px on every page the blog page, where they are positioned correctly. I can see the shift in Firebug but do not know where in CSS to fix.
http://drkateklemer.com
Thanks!
Your problem is in line 662 of your style.css for the organic natural summer theme. Change the margins to 0px, going from this:
#contenthome h1, #content h1 {
color: #333333;
font-size: 32px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
text-transform: normal;
letter-spacing: -1px;
margin: 5px 0px 5px 0px;
padding: 0px;
line-height: 32px;
}
To this:
#contenthome h1, #content h1 {
color: #333333;
font-size: 32px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
text-transform: normal;
letter-spacing: -1px;
margin: 0px;
padding: 0px;
line-height: 32px;
}
Note: Tested using Developer Tools for Chrome.
wordpress is loading the images into the content block, i dont think it your css just how images are accessed through your template
#contenthome h1, #content h1 {
color: #333333;
font-size: 32px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
text-transform: normal;
letter-spacing: -1px;
margin: 0px 0px 0px 0px;
padding: 0px;
line-height: 32px;
}