What could effect the usability of the width attribute? - css

I have a space of code that I've written for a client. It works perfectly in a test page, however it doesn't work when it's put on his actual page. The code is here...
http://jsfiddle.net/ugngp7ft/1/
.hidden_textfield {
width: 100%;
border: none;
outline: none;
background-color: transparent;
font-family: inherit;
font-size: inherit;
}
I've figured out that the issue is an inability to set the "width" attribute of the text box. Is there a way to use that attribute without going through the mountain of CSS that he already has to figure out why it can't be set? What would even cause the width attribute to have no effect on a text box? Thanks.

Completely exiting Chrome and reopening made it work on the main page. Go figure. Thanks for the time.

Related

some CSS rules are not updating in Safari

Note this is not because the css is incorrect or because Safari doesn't support these rules, its not that type of problem. I can uncheck and check the rule in the inspector and it works.
Im using Vue with sass for my website. The css works fine on every other browser, but on safari, theres a few instances where some seemingly random css rules are not taking effect.
The first example is this button, that gets enabled when the input is checked.
The button currently has the disabled class
When I check it, it removes the disabled class, meaning the background-color will be green and the font color white, this is the result
As you can see the background-color changed, but the font remained black. even though it has been updated in the inspector. In the inspector if i check the color property off and on, it will update and be correct.
Im applying these styles in the standard sass way shown below
button {
border-radius: 4px;
cursor: pointer;
font-size: 16px;
padding: 8px 12px;
font-weight: bolder;
display: flex;
justify-content: center;
align-items: center;
background-color: $secondary-color;
border: 1px solid $med-light-grey;
color: $black;
&.disabled {
pointer-events: none;
cursor: not-allowed;
background-color: $light-grey;
border-color: $med-light-grey;
color: $off-black;
}
}
I apply it to the button like this
<button v-if="!loading" #click="initalise()" class="submit" :class="{ disabled: !agreed }">Start</button>
The class does apply and remove correctly in the inspector and the color updates on every other browser
Im on Safari Version 14.1, on a new private browser, no cache, storage or anything. I dont know what could be causing this.
Here is another example where it happens
The content class stretches to 100%. But when i resize the window, making it a little bigger, the div doesnt stretch with it, so theres a gap. The background stretches as it should, and the header above it too. If i just uncheck and check the display: grid rule, everything works as it should and I can resize freely and the div will follow.
Im not sure if this is a browser issue, or the way my website is built, here are the versions that im using
"node-sass": "^5.0.0",
"sass-loader": "^10.2.0",
"vue": "^2.6.14"
Any help would be appreciated
Going to answer my own question, this was the problem for the button
pointer-events: none;
the pointer events property seems to be bugged on Safari and it will stop the DOM updating the color rule. I have found this codepen that replicates the problem and will fix when removing it.
Im guessing the 2nd example I showed is doing the same sort of thing with another property, but its a problem on Safaris end, so for that I will just restructure the html and css.
[codepen][1]

CSS - Text link larger than buttons

I have a style for inputs on my page, with some basic padding and font size, I tried applying the same style to a link, but for some reason the link is always larger (height) than the button no matter what I do, even with the exact same text and font size, I tried doing display: block but that just makes the button the width of the screen.
Here is the CSS:
.button{
padding: 10px 15px 7px 15px!important;
font-size: 16px !important;
color: white;
cursor: pointer;
border-radius: 2px;
text-decoration: none;
}
.button-3{
background-color: #ff4d4d;
border: 1px solid #ff4d4d !important;
}
I've looked at the Chrome styles panel and confirmed the font / padding is being used (it's not strikken through).
Here is what it looks like:
Looks like the issue is because:
You aren't using a CSS reset.
The line-height needs to be the same.
Make sure you give a consistent line-height to both. For now, set in the both:
line-height: 1.5;
This should fix it. Also, you can compare both the styles with the computed ones, to check if there's anything else being set. Since you say <button>, it might also have some border.
Also, like I guessed, you are also giving border and same colour as background to the button, making it look 2px bigger.
When you open the Developer Tools, try comparing the Computed Styles part:
To avoid this kind of stuff I always set the font family I used.
Take a look at this example: https://fiddle.jshell.net/tnr0jxka/
You also might want to consider adding:-webkit-apperance:none;-moz-apperance:none; to this kind of css, it will save you big time in cross-browser experience.
Buttons do not inherit the global styling automatically.
So, setting font-size of button explicitly will solve the problem
see this solution for more info

Image-free, custom-styled search bar

I'm working with the designer and he sent me the following design for the search bar on our webpage:
I'm very much against using images in webpage design unless completely necessary, so I'm hoping that I can recreate the whole search bar widget in CSS. I know how to do border-radius, gradients, box-shadows, etc, so that's not a problem.
Question: Assuming CSS3 browser compatibility, how can I go about recreating the actual search button (the magnifying glass portion) with the double curved edge, and the slight drop shadow on the bottom left?
Thoughts: My initial feeling was that the search button would be circular and free-standing, then overlap the search input div with a negative left-margin, but then I was unsure how I would get that drop shadow.
Edit: I'm not completely opposed to using an image for the magnifying glass, but I've seen a similar icon created in CSS before. Would an image vs. pure CSS end up loading at the same speed, or should I do all I can do in pure CSS?
Solving the problem a different way, you could use a font to render the magnifying glass. There are some free ones here that you could load via JS or by creating an #font-face with a service like FontSquirrel. This one comes with all the necessary files to do so and it includes the magnifying glass pointing in either direction: http://www.tenbytwenty.com/sosa.php
From there, you should be able to style it with CSS to make it look the way your designer wants.
Something like this will manage
<style type="text/css">
form {
background-image: url(1noty.png);
height: 50px;
width: 240px;
}
input {
background-image: url(bg.png);
margin-top: 15px;
margin-right: 15px;
margin-bottom: 15px;
margin-left: 17px;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
}
</style>

text-decoration: none on <a> tag around an Image shows colors in IE but not on Chrome,Firefox etc

I cannot figure out why IE shows following website with each frame encapsulated with the colors of links:
http://wilson-thun.substans.com/introduction.aspx
This doesn't happen in Chrome and Safari. Can anyone please help me in explaining this occurrence?
Best regards
I think that is css issue...
IE does not support "box-shadow"..
In this case - if you do not specify anything for images - IE will show borders where as chrome/firefox/safari will not show borders. To show the image without border everywhere you need to put BORDER="0" in the img tag.
Cheers
I've run into this issue before. Try adding border: 0; to link's css.
Try This:
a {
outline: none;
border: none;
}
a:active {
outline: none;
border: none;
}
Apply this to your CSS Document.

Cross browser button padding issues

Really simple but very annoying issue - I have a form text box which has a button sitting along side it horizontally so they should both be aligned heights. I am adding a couple of pixels top and bottom padding but i cant get this to work cross browser - internet explorer in particular seems to double the padding for some reason.
Can some one offer advice on how to get buttons the exact same size in most major browsers.
Here is the css I am using for a button
.button {
color: #44444a;
cursor: pointer;
font-weight: bold;
overflow: visible;
padding: 0.1em 1em;
width: auto;
border: solid 1px #44444a;
}
Best advice I can offer based on the very limited information you have provided is:
1 - Ensure you have declared your doctype.
2 - Perform a CSS reset. Something like:
*{
margin:0;
padding:0;
}
Googling "CSS reset" will usually turn up something useful.
3 - Know your box-model!
It would be useful if you could perhaps provide us with a bit more information (HTML & CSS code) or a link to the offending page.

Resources