Bootstrap not working at all, I don't understand why - css

<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="container-fluid">
<p>akdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdf
akdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdf
akdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdf
akdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdf
akdsjfhalsdhjflashdfklasjhdfkljashdf</p>
<p>akdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdf
akdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdf
akdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdf
akdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdf
akdsjfhalsdhjflashdfklasjhdfkljashdf</p>
</div>
<button class"btn btn-success" onclick="$(this).hide();"> Click Me! </button>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="js/myscript.js"></script>
</body>
</html>
This is the code thats not working. Could you guys please help me out. when i resize the screen nothing happens. Any help is appreciated

Your code is working.
You could see the button styled in the bootstrap fashion if you fix the HTML. Instead of:
<button class"btn btn-success" onclick="$(this).hide();"> Click Me! </button>
You should write:
<button class="btn btn-success" onclick="$(this).hide();">Click Me!</button>
You are missing the "=" symbol after the class keyword.
Regarding the content-fluid class, the only thing it does is to add the CSS to the element:
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
So you will hardly notice any change when you resize the window.

If you are writing the code in your local environment, could you please make sure that your internet is working and the URL is not blocked,
https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css
because you are taking the css from a hosted location, so if that URL is inaccessible, the code would not work.
If in doubt, try to refer the bootstrap css from your local disk.

Related

Bootstrap's Outline Buttons Behave like Regular Buttons

I'm trying to use Bootstrap's btn-outline-primary class to make a nice looking button like this
However, when I try and do that in my HTML code
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<button type="button" class="btn btn-outline-primary">Primary</button>
<button type="button" class="btn btn-outline-primary">Primary</button>
</body>
</html>
The buttons come out solid
and I don't know why. Any help would be greatly appreciated.
btn-outline-primary is only available in Bootstrap v4 and you have 3.3.7 loaded. Try giving v4 a whirl to see if it works.
See this bootply and switch between 3.3.7 and alpha v4 to demo.
Are you using the right bootstrap version? btn-outline-primary is available only in Bootstrap v4. If you are using older versions, it will not work.

Font awesome is not working with bootstrap

I am new in bootstrap
I made a new page and this is my page (there is not content on it!)
<!DOCTYPE html>
<html lang = "fa">
<head>
<meta charset = "utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TEST</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="style/index.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
</head>
<body>
<header>
<div class="container">
<a class="fa fa-ban">Test ban</a>
</div>
</header>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src = "//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
</body>
</html>
As you see I have an <a> element and it has a font-awesome class, I mean fa fa-ban, but it is not working!
What is the problem?
This works for me: https://jsfiddle.net/smit_patel/teg7kfc4/
Work fine in by this Tag.
<a><i class="fa fa-2x fa-ban"></i>Test ban</a>
try use <i> tag inside <a>
<i class="fa fa-ban"></i>Test ban
You cannot directly use the classes inside <a> tag i suspect.
So this
<a class="fa fa-ban">Test ban</a>
must be replaced with
<i class="fa fa-ban"></i>Test ban
This works for me: https://jsfiddle.net/fka3gp1b/
I would perhaps reformat your code slightly so that the font awesome icon is a child of the anchor element as follows:
<i class="fa fa-ban"></i>Test ban
Similarly, using a span tag works just as well:
<span class="fa fa-ban"></span>Test ban
Now I found the answer myself.
As you see there is a link to index.css, I had a little bad code in my index.css that is:
*, *:after, *:before{
box-sizing: inherit;
}
*, * *,{
/* Set your content font stack here: */
font-family: 'arad', Times, "Times New Roman", serif !important;
}
When I removed that, it is working correctly now!

Twitter Bootstrap 3 - wrong recognize size

I have this code:
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
<script src="http://code.jquery.com/jquery-1.11.3.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="visible-xs-block">visible-xs-block</div>
<div class="visible-sm-block">visible-sm-block</div>
<div class="visible-md-block">visible-md-block</div>
<div class="visible-lg-block">visible-lg-block</div>
</div>
</div>
</div>
</body>
</html>
When I run this on mobile, my phone recognise this as SM, but should as XS.
In this case, I can't see mobile menu with hamburger (code not include) and when I have div with xs-12 and sm-6 it displays wrong.
On PC works everything.
How can I recognise phone (XS size) correctly ?
Put the meta tag in head section.
<meta name="viewport" content="width=device-width, initial-scale=1">
If the problem persist after adding:
<meta name="viewport" content="width=device-width, initial-scale=1">
Try with
<div class="hidden-lg hidden-md hidden-sm col-xs-12">visible-xs-block</div>
instead of
<div class="visible-xs-block">visible-xs-block</div>
Anyways, your code was working fine for me.
You have already tried with google chrome inspect? In the latests version you can select various device type and brand. In this way you can test at different resolution.
The solution it's not always correct, but is a good approximation.
https://developer.chrome.com/devtools/docs/device-mode

Polymer don't like Bootstrap on chrome?

I saw several questions on this topic in here but I can't get it work for me.
I use Polymer elements with Bootstrap and it seems like the polymer elements ignore Bootstrap's css. I tried to link the CSS inside the Polymer elements but it did not fix the problem. For example, This is my Polymer element "tal-button.html":
<link rel="import" href="../components/bower_components/polymer/polymer.html">
<link href="../css/bootstrap.min.css" rel="stylesheet">
<link href="../css/bootstrapValidator.min.css" rel="stylesheet">
<polymer-element name="tal-button" attributes="">
<template>
<button class="btn btn-success">I'm a Bootstrap Button</button>
</template>
<script>
Polymer({
});
</script>
</polymer-element>
My index.html looks like this:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tal Buttons</title>
<script src="components/bower_components/webcomponentsjs/webcomponents.min.js"></script>
<link rel="import" href="elements/tal-button.html">
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- BootstrapValidator -->
<link href="css/bootstrapValidator.min.css" rel="stylesheet">
<!-- jQuery -->
<script src="js/jquery-1.11.0.min.js"></script>
</head>
<body>
<section>
<button class="btn btn-primary">Cool</button>
<tal-button></tal-button>
</section><!-- /#intro -->
</body>
</html>
The "Cool" Button is displayed well, but the Tal-Button is displayed as a regular button and it didn't get the Bootstrap style.
Any help will be appreciated. Thanks!
You need to put the stlyesheet imports into the <template>...</template> tag.
Only then are these CSS definitions visible inside the shadow dom of your tal-button element.

Background image not shown in android phonegap jquerymobile app

I'm trying to show a background image on an Android phonegap app based on jQuerymobile.
This is the HTML
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/jquerymobile.css" />
<link rel="stylesheet" href="css/index.css" />
<script src="js/jquery.js"></script>
<script src="js/jquerymobile.js"></script>
</head>
<body>
<div data-role="page" id="Main" class="main-page">
<ul data-role="listview" data-filter-reveal="true" data-filter="true"
data-filter-placeholder="Insert the city here..." data-inset="true">
<li>Limone Piemonte</li>
<li>Artesina</li>
<li>Tonale</li>
</ul>
</div>
<!-- /page -->
</body>
</html>
This is the CSS (index.css)
.main-page {
background: transparent url(img/alpettalownologo.jpg) no-repeat center center;
background-size: cover;
}
But I see no image in background. What am I missing?
I'm guessing your url(img/alpettalownologo.jpg) is not correct as this would mean it's in a sub directory of your CSS files.
The location of the background image needs to be in relation to that particular CSS file, so maybe url(../img/alpettalownologo.jpg) as a guess would work, depending on your file structure.

Resources