CSS selector not selecting h1 element - css

I am going to include the full code, since I am not sure where the problem is but the element I'm trying to target is the <h1>PC Lee</h1>, I am trying to change the font color to white but it is not working:
{% extends 'core/base.html' %}
{% load static %}
{% block head %}
<link rel="stylesheet" type="text/css" href="{% static 'core/style/index2.css' %}" />
<!--links specific to style sheet 2 -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300" rel="stylesheet">{% endblock %}
{% block body %}
<div id="jumbotron">
<ul>
<li class="align_left">PCLee</li>
<li class="align_right">Repairs/Upgrades</li>
<li class="align_right">Networking</li>
<li class="align_right">Remote Backups</li>
<li class="align_right">Data Recovery</li>
</ul>
<div id="h1_div"><h1>PC Lee</h1>
<img id="image" src="{% static "core/images/logo.png" %}" alt="My image" height="400" width="200"/>
</div>
</div>
<h1>dafs</h1>
<div id="grid">
<div id="content">
<h1>About Us</h1>
<img src="{% static "core/images/first_img.jpeg" %}" alt="My image"/>
<p>PCLee Computer has been dedicated to providing outstanding technical support to the New York Tri-State area for over 10 years. Specializing in computer sales, repair services, and networking. We have grown our business with individualized attention, honest diagnosis and fast turn-around. PCLee Computer prides itself on customer satisfaction. </p>
<p>Our technicians can assist your home or office computer repairs, computer setup, software and operating system upgrades, internet connection problems, wireless networking, peripherals (cameras, scanners, printers, iPods,), spyware and virus removal, and all other frustrating computer problems.</p>
</div>
<div id="contact_form">
<h2>Contact Us</h2>
<form role="form" action="" method="post">
{% csrf_token %}
<p>Full Name: <input type="text"></p>
<p>Email:<input type="text"></p>
Inquiry:<textarea></textarea>
<button type="submit">Submit</button>
</form>
</div>
</div>
{% endblock %}
and the css:
h1{
font-family: 'Open Sans Condensed', sans-serif;
color: white !important;
font-size: 1em;
}
none of these css statements are effecting the h1 element, but the css file is properly linked because all of the other css statements are working. Thanks for any help

Have you tried this
#h1_div h1 {
color: white;
}

Make sure your CSS file loaded. If it is loaded it can be overwritten by below CSS file.
Keep your custom CSS file below the CSS file you referenced.

You may have a CSS file being loaded after your custom one, overriding the desired properties.

Related

Css & asset issue with Symfony

I wanted to take a free template to start my RolePlay forum with a "good looking" homepage; and I found this one: Template preview
The template himself is working fine, if I'm openning the given downloaded index.html there no problem.
Then I "translated" that page to work with my Symfony.
Here is what I got:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>
{% block title %}Way Of Shogun {% endblock %}
</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/main.css') }}" />
<link rel="stylesheet" href="{{ asset('css/style.css') }}"/>
{% endblock %}
</head>
<body>
<div id="container">
<div id="header">
<div id="nav">
<ul>
<li>
Home
</li>
<li>
Game Guide
</li>
<li>
Interactive
</li>
</ul>
<ul>
<li>
Account
</li>
<li>
Support
</li>
<li>
Media
</li>
</ul>
</div>
</div>
<div id="content1">
<div id="text1">
<img src="{{ asset('images/cap-night-elf.gif') }}" alt="Caption" />
<div class="heading">BEST RELEASE OF THIS MONTH</div>
<br />
<p>Don't forgot to check free website templates every day, because we add at least one free website template daily.</p>
<p>This is a template designed by free website templates for you for free you can replace all the text by your own text. This is just a place holder so you can see how the site would look like.</p>
<p>You can remove any link to our websites from this template you're free to use the template without linking back to us. Don't want your boss to know you used a free website template ;).</p>
<p>If you're looking for beautiful and professionally made templates you can find them at Template Beauty.</p>
<p>
<div class="heading">MORE GAMES</div>
</p>
<p>
<span class="flt-lft"><img src="{{ asset('images/image-1.gif') }}" alt="More Games" /></span>
<span class="flt-lft"><img src="{{ asset('images/image-2.gif') }}" alt="More Games" /></span> <strong>Gnome mage by Someone</strong><br />
<br />
Etiam ullamcorper mi eu libero bibendum consequat. Cras volutpat .<br />
<span class="flt-rgt">...more</span>
</p>
</div>
</div>
<div id="pagebottom">
<div id="left">
<div id="text2"> <img src="{{ asset('images/cap-community-news.gif') }}" alt="Community News" />
<p>
<div class="heading2">THUNDGOT, AEUS, & VANERUS, 19/10/2006</div>
</p>
<p>Don't forgot to check free website templates every day, because we add at least one free website template daily.</p>
<p>This is a template designed by free website templates for you for free you can replace all the text by your own text. This is just a place holder so you can see how the site would look like.</p>
<p>You can remove any link to our websites from this template you're free to use the template without linking back to us. Don't want your boss to know you used a free website template ;).</p>
<p>If you're having problems editing the template please don't hesitate to ask for help on the forum.</p>
<p>If you're looking for beautiful and professionally made templates you can find them at Template Beauty.</p>
<p>To find great hosting providers visit Web Hosting Zoom</p>
</div>
</div>
</div>
</div>
{% block body %}{% endblock %}
<div id="right">
<div class="heading2">QUICK LINKS</div>
<div id="quicklinks">
<ul>
<li>Home</li>
<li>Realms Status</li>
<li>Account Creation</li>
<li>Account Management</li>
<li>Cetrieve Passward</li>
</ul>
</div>
<div class="heading2">SCREENSHOT OF THE DAY</div>
<img src="{{ asset('images/screenshot.jpg') }}" alt="Screenshot" /> <br />
Cross Realm Battlegrounds<br />
World PvP <br />
Rogue Talents revamped
</div>
<div id="footer">
Home | Game Guide | Interactive | Community | Account | Support | Media
<p>
Legal Documents |
Game Policies
<br/>©2006
WorldofWarcraft.com. All rights reserved. | designed by
free website templates
</p>
</div>
</div>
<div align=center>This template downloaded form <a href='http://all-free-download.com/free-website-templates/'>free website templates</a></div>
</body>
</html>
Sorry, for the bad indentation, it's crazy to clean a code like that :(
Anyway, as I said, I've just translated to replace the images by the asset link.
But as a results, the frontend isn't the same and I can't see what's wrong.
Hope you can help me on this ;) Thanks.
Here is a screen of what I'm getting.
To be more specific, I checked the networks calls and all the images and css and well found
How it is suppose to be:
Thanks again

Image size/resolution based on webpage layout

For the given below webpage,
<!DOCTYPE html>
<html lang="en">
<head>
<title>xyz</title>
<meta charset="utf-8" />
{% load staticfiles %}
<link rel="stylesheet" href="{% static 'personal/css/bootstrap.min.css' %}" type = "text/css"/>
<meta name="viewport" content = "width=device-width, initial-scale=1.0">
<style type="text/css">
html,
body {
height:100%
}
</style>
</head>
<body class="body" style="background-color:#f6f6f6">
<div class="container-fluid" style="min-height:95%; ">
<div class="row">
<div class="col-sm-2">
<br>
<center>
<img src="{% static 'personal/img/profile.jpg' %}" class="responsive-img" style='max-height:100px;' alt="face">
</center>
</div>
<div class="col-sm-10">
<br>
<center>
<h3>My blog</h3>
</center>
</div>
</div><hr>
<div class="row">
<div class="col-sm-2">
<br>
<br>
<!-- Great, til you resize. -->
<!--<div class="well bs-sidebar affix" id="sidebar" style="background-color:#fff">-->
<div class="well bs-sidebar" id="sidebar" style="background-color:#fff">
<ul class="nav nav-pills nav-stacked">
<li><a href='/'>Home</a></li>
<li><a href='/blog/'>Blog</a></li>
<li><a href='/contact/'>Contact</a></li>
</ul>
</div> <!--well bs-sidebar affix-->
</div> <!--col-sm-2-->
<div class="col-sm-10">
<div class='container-fluid'>
<br><br>
{% block content %}
{% endblock %}
</div>
</div>
</div>
</div>
<footer>
<div class="container-fluid" style='margin-left:15px'>
<p>Contact | LinkedIn | Twitter | Google+</p>
</div>
</footer>
</body>
</html>
<img src="{% static 'personal/img/profile.jpg' %}" class="responsive-img" style='max-height:100px;' alt="face"> is loaded using Django templating.
Above page uses bootstrap css framework, for responsive design
Image size/resolution impacts utilisation of network bandwidth.
Appropriate image size helps in creating responsive UI design.
In real time, we get images from client(customer) based on the size/resolution that we request to client(customer). Images can be IP property of client, until the website goes in production.
Question:
Amidst development process, for requesting to client(customer), How to decide the final size/resolution of an image to embed in web page, for any given layout of web page?
One way to do this is to put images of a different size in the template and then make sure that browser renders the appropriate image. You can use picture html tag for this:
<picture class="responsive-img" style='max-height:100px;' alt="face">
<!-- low-res, default -->
<source src="{% static 'personal/img/profile.jpg' %}">
<!-- med-res -->
<source src="{% static 'personal/img/profile.medium.jpg' %}"
media="(min-width: 400px)">
<!-- high-res -->
<source src="{% static 'personal/img/profile.large.jpg' %}"
media="(min-width: 800px)">
<!-- Fallback content -->
<img src="{% static 'personal/img/profile.jpg' %}" alt="face">
</picture>

Changing the background-color of a jumbotron from bootstrap in django

I am very new to web development and Django. I am following a tutorial called "Try Django 1.8".
In this code I am supposed to change the background-color of jumbotron to #155A1E.
If I press shift + refresh in google chrome, the color shows up then it changes back to gray. When I inspect the code in google chrome, I can see in the styles tab that the background-color in the .jumbotron{} has a strike-through. Also there is another verion of .jumbotron{} in the styles tab that has a background-color and has a check. If I uncheck the box, the color gets fixed.
How can I fix this in Django?
{% extends "base.html" %}
{% load crispy_forms_tags %}
{% block head_title %}Welcome | {{ block.super}}{% endblock %}
<style>
{% block style %}
.jumbotron {
background-color: #155A1E;
}
{% endblock %}
</style>
{% block jumbotron %}
<div class="jumbotron">
<div class='container'>
<div class="row">
<div class='col-sm-6'>
<h1>Try Django 1.8</h1>
<p>Some text here!!! This text should be long so that we can test the columns in the webpage. So here we go. We are trying to make this line as long as possible.</p>
<p>
<a class="btn btn-lg btn-primary" href="" role="button">Join us »</a>
</p>
</div>
<div class='col-sm-6' style="background-color:black;height:300px">
</div>
</div>
</div>
</div>
{% endblock %}
{% block content %}
<div class="row">
<div class="row">
</div>
<div class="col-xs-3 pull-right">
<p class='lead text-align-center'>{{ title}}</p>
<!--{{ user }}-->
<!--<!–{{ request.user }}–>-->
<!--abc is = {{ abc }}-->
<form method='POST' action=''>{% csrf_token %}
{{ form|crispy }}
<input class='btn btn-primary' type="submit" value="Signup" />
</form>
</div>
<div class='col-sm-3'>
<p class='lead text-align-center'>Built with Django & Bootstrap</p>
</div>
<div class='col-sm-3'>
<p class='lead text-align-center'>created for starters of all kinds.</p>
</div>
<div class='col-sm-3'>
<p class='lead text-align-center'>Always open source.</p>
</div>
</div>
{% endblock %}
You can add do important to your css attribute.
Just like that:
.jumbotron {
background-color: #155A1E!important;
}
It will be taken instead of the default one
It may be very late to answer the question but could help someone who is doing the tutorial now as myself.
Problem is your style should come under the
{% block jumbotron %}
otherwise its never been executed.
Here it is
{% block jumbotron %}
<style>
{% block style %}
.jumbotron {
background-color : #1e78d2 !important;
}
{% endblock %}
</style>
<div class="jumbotron">
<div class="container">....... {% endblock %}
Hope it helps someone
Makesure source of bootstrap is before your style source, and example:
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet" media="all">
<link href="{% static 'css/your_style.css' %}" rel="stylesheet" media="all">

CSS is not getting applied to jinja2 templates

I am not able to apply the CSS to the jinja2 templates.
I think it should work, but dont know where i am missing it.
My Layout:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="{{url_for('static', filename='style.css')}}">
<link rel="stylesheet" href="{{url_for('static', filename='bootstrap.min.css')}}">
<title>
{% block title %} {% endblock %}
</title>
</head>
<body>
<div class='container-fluid'>
<div class='row'>
<div class='col-md-9'>
{% block body %} {% endblock %}
</div>
<div class='col-md-3'>
Menu
</div>
</div>
</div>
</body>
</html>
Home page:
{% extends "layout.html" %}
{% block title %}
Home
{% endblock %}
{% block body %}
<div class="row">
<div class="col-md-6 min-data">
My Lappy - DELL VOSTRO
</div>
<div class="col-md-6 min-data">
<img class="pull-right" src="http://placehold.it/360x203">
</div>
</div>
{% endblock %}
The CSS file:
.min-data {
background-color: green;
}
The Home page is rendered properly but the the background color is not getting applied as green in the div in the home page.
I think you are trying to Chrome browser for this issue. Please try another browser like firefox latest version.

increase a value in a css class in twig

I have a css class to which the layout in html5 and css3 you have enclosed a :hover background-color, this color is stored in the database and pick it up at the controller, now do not know how to make this :hover background-color on-screen display. What I thought is to include html code in the middle of a label with that style and tell the class that suffers the html tag :hover to increase one, in this way would go picking the value increases
This is kind of my idea in code:
<ul class="sub">
{% for key, c in categorias %}
<li class="hover">
<a href="elemento.html">{{ c.nombre }}
<div class="icon" style="background-color: #{{c.color}}">
<img src="{{ asset('images/iconoportada/' ~ c.iconoNombre)}}" alt="elemento" />
</div>
</a>
</li>
{% endfor %}
each list item has a :hover background different, like the current background catch it from the database, the problem is that I could not capture the: hover css here so I thought Twig
I would use something like this:
{% for key, c in categorias %}
<li class="hover">
<a href="elemento.html">{{ c.nombre }}
<div class="icon" rel="#{{c.color}}">
<img src="{{ asset('images/iconoportada/' ~ c.iconoNombre)}}" alt="elemento" />
</div>
</a>
</li>
{% endfor %}
and Jquery
<script>
$(document).ready(function(){
var oldbg = "";
$(".icon").hover(function(){
oldbg = $(this).css("background-colod");
$(this).css("background-colod", $(this).attr("rel"));
}, function(){ $(this).css("background-colod", oldbg); } );
}
</script>
not tested... just from the top of my head.

Resources