如何使文本适合div的宽度.这是我的代码
<div class="column">
<a href="#" class="user_thumbnail">
<img src="<?=base_url()?>/images/1.jpg" width="100px" height="100px">
</a>
<span class="name">texttexttexttexttexttexttexttexttexttext</span>
</div>
Run Code Online (Sandbox Code Playgroud)
当我试图显示文本时,文本溢出div就像一条直线.我怎样才能使css符合宽度<div class="column">(宽度= 33%).
我是android的新手.我正在研究一个巫婆的android项目我需要使用GPS获取用户的当前位置.但是我的代码工作不正常.
java代码
package com.example.checkinapp;
import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends Activity
{
TextView textlat;
TextView textlong;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textlat = (TextView)findViewById(R.id.textlat);
textlong = (TextView)findViewById(R.id.textlong);
LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
LocationListener ll = new mylocationlistener();
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, ll);
}
class mylocationlistener implements LocationListener{
@Override
public void onLocationChanged(Location location) {
if(location!=null)
{
double lat = location.getLatitude();
double lng = location.getLongitude();
textlat.setText(Double.toString(lat));
textlong.setText(Double.toString(lng));
}
} …Run Code Online (Sandbox Code Playgroud) 如何在重定向后从模板中的会话中检索数据.实际上可能吗?
这是我的代码:
View.py:
if request.POST:
user = request.POST.get('username')
passw = request.POST.get('password')
#password1 = ''
try:
userdata = Employee.objects.get(username = user, password = passw)
user_id = request.session["user_id"] = userdata.id
employee_details = Employee.objects.get(id=user_id)
request.session['emp_details'] = employee_details
return HttpResponseRedirect('/home/')
except Employee.DoesNotExist:
state = "Username or password incorrect !"
return render_to_response('login.html',
{'username' : username1,'state' : state},
context_instance = RequestContext(request))
Run Code Online (Sandbox Code Playgroud)
模板:home.html
<body>
<p>
<ul>
<li><a href="">{{request.session.emp_details.emp_name}}</a></li>
</ul>
</p>
<p><a href="/logout/"><button>logout</button></a></p>
</body>
Run Code Online (Sandbox Code Playgroud)
谢谢