Buttons created in HTML5 that will fit any screen resoution - css

I am creating a web site for a friend and is strictly practice for me. So far I have got the banner w/ logo to fit any screen, but now I am adding buttons so a user can navigate through out the site. When zooming in or out the buttons go all over the place. I am using an external CSS sheet to help format my HTML. Here is my CSS3 code
/* W & W Hydrographics, LLC. */
/* Robert W. Anderson HTML 5.0 */
.mybutton {
display: inline-block;
position: relative;
margin: 10px;
padding: 0 20px;
text-align: center;
text-decoration: none;
font: bold 30px/35px Arial, sans-serif;
box-shadow:#000 4px 4px 5px;
}
/* Our Gallery */
.gallery {
position:absolute;
left:5%;
top:5%;
color: #F5DA62;
background: #3F403D;
}
/* Available Patterns */
.patterns {
position:absolute;
left:300px;
top:230px;
color: #F5DA62;
background: #3F403D;
}
/* Contact Us */
.contact {
position:absolute;
left:650px;
top:230px;
color: #515151;
color: #F5DA62;
background: #3F403D;
}
body {
background-size: 100%
}

You can use CSS3 to find the width of the screen and adjust the size of the buttons(again, according to the size).Here is a small explanation of an example just so you can unserstand.Suppose I had a button with id #button with a 300px width like this-
#button{
width:300px;
}
If i wanted to change the width to 100px in mobiles(mobiles have average width 470px;) I can do it like this-
#media (max-width: 470px) {
#button{
width:300px;
}
}
You can use the same logic to adjust size of other elements and even multiple elements at the same time like this-
#media (max-width: 470px) {
#button{
width:300px;
}
#button2{
width:300px;
}
#someelement{
color:#C30;
}
}
If you didnt understand a part of my answer, just comment. I am free to answer more doubts.

Related

Positioning a button and preventing movement?

As you can see from this image of my site:
https://www.flickr.com/photos/77598212#N03/33735427334/in/dateposted-public/
My button is crammed right underneath the randomly generated text. Instead, I'd like to lower it.
But additionally, I'm trying to keep it completely "anchored" to the page, because right now when I click the button, a random image generates, but that image is moving the button vertically depending on the size of the image. Not good.
Instead, I'd like that button to remain in the same position, always.
Any thoughts/help would be appreciated. I'm still quite new to all this. Thank you. -Wilson
link to the actual website http://www.wilsonschlamme.com/test4.html
css:
*It's pretty simple. First two elements here are controlling centering the page. The rest are self explanatory, showtext refers to the random text generator.
*{
margin:0;
padding:0;
}
body{
text-align:center; /*For IE6 Shenanigans*/
}
button {
color: #900;
font-weight: bold;
font-size: 150%;
text-transform: uppercase;
}
h1{
margin-top:20px;
font-size: 250%;
overflow:hidden; /* older browsers */
font-family: hobeaux-rococeaux-sherman, sans-serif;
}
img {
max-width:600px;
max-height:440px;
box-shadow: 1px 5px 5px grey;
border-style: groove;
border-width: 1px;
margin-top:20px;
}
#ShowText{
overflow:hidden; /* older browsers */
word-wrap: break-word;
padding-top: 100px;
max-width: 1000px;
font-size: 25px;
font-family: vendetta, serif;
line-height: 25px;
margin: 0 auto;
}
Use:
#buttonfun {
margin-top: 20px;
}
Wrap the img with a div:
<div class="image-wrapper">
<img src="images/297.jpg" />
</div>
and add the CSS:
.image-wrapper {
height: 440px;
}

Bootstrap Dropdown Menu too big

I cannot figure out why my bootstrap dropdown menu seems to have an extra line on top and line on the bottom--with nothing in them. Granted, I have made my navbar 150px for all resolutions but that doesn't explain the extra padding on the bottom. This is my first bootstrap project and I have searched high and low for an answer to this. You have to narrow the window to less than 767 pixels for the dropdown option to appear.
This is the page: http://www.ashlandlockandsafe.com/index3.html.
In the CSS, I have tried to address it with the following:
#media screen and (max-width: 767px) {
.navbar-header{
height:150px;
}
.navbar-brand, .navbar-nav > li > a {
line-height: 30px;
height: 45px;
padding: 0px;
margin-top:0px;
margin-left:10px;
}
.well {
font-size:2.5em;
text-align:center;
text:#000;
padding:0;
border:#000 solid 4px;
background-image:url(../images/metal.png);
background-image:no-repeat;
background-size:contain;
background-position:center;
}
.carhelp {
margin-top:15px;
}
h1 {
text-align: center;
font-size: 30px;
}
.phonetxt {
font-size:36px;
text-align:center;
}
But it still has what appears to be an extra row on the top and bottom. Any ideas how to address the dropdown itself?
In website, fixed header has a padding .navbar-fixed-top .nav{60px 0px} causing the problem.
so solution is media queries
#media (max-width: 480px) {
.navbar-fixed-top .nav {
padding: 0px 0px;
}
}
so on devices like mobile, it will over-ride the default .navbar-fixed-top .nav selector property.
More information about media-queries

CSS logo not responsive on mobile devices

Hello I am new with CSS
I think I have broken the CSS on my page
the logo runs off the page on mobile devices
if anyone could point me as to why this is not responsive?
thanks
check the site here http://finddaytrips.com/dev
Paul
---------------------------css below ------------------
.logo-wrap {
background:url(images/bg-header.png) repeat-x;
min-height:89px;
position:relative;
}
.logo-wrap:before {
content:"";
display:block;
height:100%;
left:-100%;
position:absolute;
top:0;
width:100%;
}
.logo-wrap:after {
content:"";
display:block;
height:100%;
right:-100%;
position:absolute;
top:0;
width:100%;
}
.logo-wrap:before { background:url(images/bg-header.png) repeat-x; }
.logo-wrap:after { background:url(images/bg-header.png) repeat-x; }
.logo {
position:absolute;
top:15px;
left:25px;
text-align:center;
}
#media (min-width: 768px) and (max-width: 979px) {
.logo { width:100%; }
}
#media (max-width: 767px) {
.logo {
position:relative;
top:0;
margin:20px 0;
}
.logo.pull-left { float:none;
}
}
.logo a {
filter:none !important;
background-color:#393939;
background-image:-moz-linear-gradient(top,#434343,#292929);
background-image:-webkit-gradient(linear,0 0,0 100%,from(#434343),to(#292929));
background-image:-webkit-linear-gradient(top,#434343,#292929);
background-image:-o-linear-gradient(top,#434343,#292929);
background-image:linear-gradient(to bottom,#434343,#292929);
background-repeat:repeat-x;
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff434343', endColorstr='#ff292929', GradientType=0);
display:block;
padding:14px 11px 12px 11px;
border-radius:6px 6px 0 0;
}
#media (max-width: 767px) {
.logo a { text-align:center; }
}
.logo p {
background:#8ec63f;
border-top:1px solid #fbde02;
font:italic 34px/1.1em 'Orbitron', sans-serif;
font-weight:900;
text-align:center;
padding:0 5px 5px 0;
color:#2c2c2c;
margin:0;
border-radius:0 0 6px 6px;
}
#media (min-width: 768px) and (max-width: 979px) {
.logo p { font-size:16px; }
}
.logo .logo_h__txt { text-align:center; }
.logo .logo_h__txt a { padding:5px 15px 5px 5px; }
.logo .logo_h__txt a:hover, .logo .logo_h__txt a:active {
color:#fff;
text-decoration:none;
}
Your image is responsive! There is other parts of your code that are affecting the logo.
Unfortunately I will add that you should improve our skills in responsive design, even after I give you these changes to fix your logo, your site is just not working at certain sizes, your site needs some serious work for virtually every phone in landscape mode. Not only are there duplicate media queries, there is also media queries in your code for 760px (as well as 767px shown in your example) which doesn't look good if re-sizing a window and not good practice in general.
To fix the logo problem,...
You do not require the pseudo elements ::before and ::after on .logo-wrap.
You need to completely remove the absolute positioning of .logo as well as top and left.
You also need to remove margin from the .logo class in the media query "max-width: 767px".
To replace this spacing I would add padding: 10px; to the class .span4 on your page (which is not listed in the code above)
I do not believe you require <div class="spacer"> either! (also not in the code above)
Good luck in your site building.
Just add img-responsive to your logo image class like this
<img src="logo.png" class="img-responsive">
but use bootstrap
put the links on the header and the script source on the footer
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
See reference
http://getbootstrap.com/css/#images

How to target content through css

I have this html that I cannot edit:
<div id="menu">
Home |
Meet Our Physicians |
Services |
</div>
I have to make it responsive and when when on mobile I want to delete the |
How can I target it? Something like:
#media screen and (max-width:480px){
element{
display:none;
}
}
Try this:
#media screen and (max-width:480px) {
#menu > a{
margin-right: -10px; /* getting the elements closer */
}
#menu {
color: transparent; /* making the open text's color transparent */
}
}
Working Fiddle
The only way to emulate this (CSS cannot target text that is not part of an element, unfortunately), is to target the containing element and then override the styling in the descendant <a> elements:
#media screen and (max-width:480px){
#menu {
font-size: 0;
}
#menu a {
font-size: 16px; /* or whatever */
margin: 0 0.5em; /* or whatever, to restore some spacing between elements */
}
}
Edit:
Maybe something like that:
#media screen and (max-width:480px){
#menu {
text-indent: -9999px;
font-size: 0px;
}
#menu a {
text-indent: 0px;
font-size: 14px;
}
}

Styling for Mobile; "Choose File" Button Too Small in iOS 6

I'm currently working on styling a couple of simple form pages originally written in ASP.NET for mobile. I'm using media detection in CSS3 to determine if the device is mobile, and if it is, I basically make everything look bigger. This has worked so far in most of the phones I've tested, but in iOS6, the "choose file" button stubbornly refuses to get bigger like every other element. I've tried styling it by its ID or just through all inputs, and while I can change the color or the font, the size never changes. How can I make the choose file button look bigger?
My CSS page:
#import url(master.css);
/* --- page wrapper --- */
#wrapper { width:80%; margin:auto; max-width:1200px; position:relative; border:1px solid #000; background-color:#000; }
#main { width:100%; height:100%; border-bottom:1px solid #000; }
#content { height:100%; background-color:#CDCCCC; padding: 20px 50px 20px 50px; }
#login { text-align:center; }
#upload { padding:10px; }
#list { display: inline; width: auto; height: auto; }
#logoutButton { display: inline; float: right; }
#guidelines {
text-align:justify;
}
#flash {
padding: 20px;
}
#media only screen and (max-width: 720px), only screen and (max-device-width: 720px) {
#logoutButton {
display: inline;
float: right;
}
#guidelines {
background-image:url(http://cite.nwmissouri.edu/PhotoContest_MobileApp/transparentbg4androidwidthbug.png);
background-repeat:repeat;
text-align:inherit;
height:100%;
background-color:#CDCCCC;
}
#hwrapper {
width:initial;
}
#contentum {
height: 100%;
width:inherit;
background-color:#CDCCCC;
text-align:inherit;
font-size:40px;
padding-right: 5px;
}
input {
font-size:40px;
height:inherit;
width:inherit;
}
select {
font-size:40px;
height:auto;
width:inherit;
}
#upload {
font-size: 40px;
text-align: start;
height: 100%;
width: 100%;
padding-right: 12px;
}
#wrapper {
width:inherit;
height:inherit;
margin:auto;
position:inherit;
border:1px solid #000;
background-color:#000;
overflow:scroll;
}
li {
font-size: 40px;
text-align: start;
}
}
If I understand, you want the file upload (<input type="file"/>) button to display larger?
You should be able to use the following (non-standard) psuedo-element selector for WebKit:
input[type="file"]::-webkit-file-upload-button {
/* add styles here, such as width, height etc. */
}
You can do the same in IE10 using (a similarly non-standard):
input[type="file"]::-ms-browse {
/* add styles here, such as width, height etc. */
}

Resources